Please write ONE SQL statement for each of the following tasks using the below tables. Note that you can only use conditions specified in the task description and cannot manually look up data and add conditions.
Task 1: return title of textbooks with price over $100.
Task 2: return number of courses sections scheduled for each year and semester. Please return year, semester, and number of courses.
Task 3: Return names of all courses in Information Systems undergraduate program.
Task 4: return titles and prices of textbooks for IS 420 section 1 in spring 2019.
Task 5: return names of courses offered in 2019 spring and have at least 2 sections.
Task 6: for each text book, return the title of the text book and total number of students registered for courses using that text book in spring 2019.
The list of tables are:
Program table:
pid, --- program id
pname, --- program name
ptype --- program type (1: undergraduate, 2: graduate)
Teacher table:
tid, --- teacher id
tname --- teacher name
Author table:
aid, --- author id
aname --- author name
Textbook table:
tbid, --- text book id
title, ---- title of book
publisher, --- publisher name
edition, --- edition, e.g., 3 means 3rd edition
quantity, --- number of copies in store
price --- price of the book
Course table:
cid, --- course id
cname, --- course name
pid --- program id
Schedule table: (scheduled course sections)
sid, --- schedule id, unique for each scheduled class section
cid, --- class id
snumber, --- section number, e.g., 2 means section 2 of the class
semester, --- spring, fall, summer, winter,
year, --- year of the class
tid, --- teach id who teaches this section
num_registered --- number of registered students for this class section
Textbook_author table:
aid, --- author id
tbid --- text book id
Textbook_schedule table:
sid, --- schedule id
tbid --- text book id
Task1:
SELECT title FROM Textbook WHERE price > 1400;
Task2:
SELECT Schedule.year,Schedule.semester,COUNT(Course.cid) AS
SemCount FROM Schedule
INNER JOIN Course ON Course.cid = Schedule.cid GROUP BY
Schedule.year,Schedule.semester;
Task3:
SELECT cname FROM Course INNER JOIN Program ON Course.pid =
Program.pid WHERE Program.pname = "Information Systems
undergraduate program";
Task4:
SELECT Textbook.title,Textbook.price FROM Textbook INNER JOIN
Textbook_schedule ON Textbook_schedule.tbid = Textbok.tbid
INNER JOIN Schedule ON Schedule.sid = Textbook_schedule.sid
INNER JOIN Course ON Course.cid = Schedule.cid
WHERE Course.cname = "IS",Course.cid = 420,Schedule.snumber =
1,Schedule.semester = "spring",Scedule.year = 2019;
Task5:
SELECT Course.cname FROM Course INNER JOIN Schedule ON Course.cid =
Schedule.cid
WHERE Schedule.snumber >= 2,Schedule.semester =
"spring",Schedule.year = 2019;
Task6:
SELECT Textbook.title,Schedule.num_registered FROM Textbook INNER
JOIN Textbook_schedule ON Textbook.tbid =
Textbook_schedule.tbid
INNER JOIN Schedule ON Textbook_schedule.sid = Schedule.sid
WHERE Schedule.semester = "spring",Schedule.year = 2019;
Please write ONE SQL statement for each of the following tasks using the below tables. Note...
Problem 1. Please create the following tables for UMBC bookstore’s textbook management system with appropriate primary keys & foreign keys. Please include drop table statements with cascade constraints before your create table statements so it is easier to grade your create table statements. E.g., suppose you will create table tab1, tab2, including the following before creating them: Drop table tab1 cascade constraints; Drop table tab2 cascade constraints; Assumptions: Each teacher can teach one or more scheduled course sections. Each scheduled...
Use the SQL statements provided to create your tables. Write one SQL statement for each of the following problems. You can only use the conditions listed in the tasks. E.g., in task 1, you cannot manually look up pid of Information Systems undergraduate program. Here is the given code: drop table textbook_schedule cascade constraints; drop table textbook_author cascade constraints; drop table schedule cascade constraints; drop table course cascade constraints; drop table textbook cascade constraints; drop table author cascade constraints; drop...
Suppose a student is taking IS 620 section 1 and HCC 629 section 1 for spring 2019. Use an explicit cursor to print out the titles and prices of textbooks for these two courses. Sample code to create the tables: drop table textbook_schedule cascade constraints; drop table textbook_author cascade constraints; drop table schedule cascade constraints; drop table course cascade constraints; drop table textbook cascade constraints; drop table author cascade constraints; drop table teacher cascade constraints; drop table program cascade constraints;...
Create sql queries to find the following miscrosoft access compatible commands please 9. Courses for which at least three students earned a grade of A, showing the grade and the course code 10. Semesters when the highest number of courses have been scheduled, showing the semester name and the number of sections 11. (Extra) Professors that are not students, and students that are not professors, showing their ID and SSN 12. (Extra) Semesters for which all courses are taught by...
Please answer questions 4 to 7 please type the answers SQL Given the tollowing whema COURSE ode. Thle, Credits) EXAMCAurse. Stadent. Grade, Score GRADUATIONPALHOure, Suedent) SCHEDULE(Professor, Course, Semester Section PROFESSORİD, Name, SSN) STUDENTOİD, Name, SSN) Formulate SQL queries to find he bove 4. People that are students but are not professors, showing the people name and SSN 5. The courses for which classes have been scheduled but the professor is yet to be defined showing the course title, the semester,...
Question: Write one SQL statement for the following question: Return number of players whose rating is over 1000. Background information: This is a chess tournament management database that stores information about chess players, tournaments, sections, registrations, and pairings. Each player has an ID, name, grade (0 to 12) and rating. Each tournament has a number of sections. Each player can register for a section of a tournament In each round of a tournament, players in the same section will be...
This is database system concept. 1.Find the ids of instructors who are also students using a set operation. Assume that a person is identified by her or his id. So, if the same id appears in both instructor and student, then that person is both an instructor and a student. Remember: set operation means union, intersect or set difference. 2.Find the ids of instructors who are also students using the set membership operator. 3.Find the ids of instructors who are...
Problems and Exercises 1 through 9 are based on the dass scheduling 3NF relations along with some sample data shown in Figure 6-11. Not shown in this figure are data for an ASSIGNMENT relation, which represents a many-to-many relationship between faculty and sections.4. Write SQL data definition commands for each of the following queries:a. How would you add an attribute, Class, to the Student table?b. How would you remove the Registration table?c. How would you change the FacultyName field from...
Question 1.Write a SQL statement for each of the following questions based on the above tables (50 Points). 1) Create “Enrollment” table. 2) Change the credits of “Database” course from 2 to 3. 3) List the course titles (not Course_No) and grades John Doe had taken. 4) Calculate average of Café Balance, and name new field as Average Balance. 5) Create a roster for “Database” course (list student ID, last name, first name, major, and status for each student enrolled...