Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. 3 pts] Write a SQL statement that creates a table named \"Course\" and has th

ID: 3904246 • Letter: 1

Question

1. 3 pts] Write a SQL statement that creates a table named "Course" and has three attributes named "CourselD". "CourseName". and InstructorlD". "CourselD" is the primary key of the table and "InstructorlD" is a foreign key from the Instructor table. Course CourseID, Course Name, InstructorlD) Instructor (InstID, InstName, salary) 2. [2 pts Write a SQL statement that inserts one record to the above "Course" table. 3. [2 pts Write a SQL statement that updates a value of one of the attributes of the above Course" table 4. 3 pts] Write a query in English for the following SQL statement: select ql. from (select customer id, count( ordercount from cust order group by customer id)q (select max(count") highest from cust order group by customer id) 2 where ql.ordercount q2.highest

Explanation / Answer

If you have any doubts, please give me comment...

1)

CREATE TABLE Instructor(

InstID INT NOT NULL PRIMARY KEY,

InstName VARCHAR(100),

salary REAL(10,2)

);

CREATE TABLE Course(

CourseID INTEGER NOT NULL PRIMARY KEY,

CourseName VARCHAR(100),

InstructorID INTEGER,

FOREIGN KEY(InstructorID) REFERENCES Instructor(InstID)

);

2)

INSERT INTO Instructor VALUES(1, 'John Abraham', 20000.00);

INSERT INTO Course VALUES(100, 'DBMS', 1);

3)

UPDATE Course SET CourseName='Database Management System' WHERE CourseID =100;

4)

SELECT customer_id, count(*) ordercount from cust_order group by customer_id;

It will return for each customer, how many orders processed

SELECT max(count(*)) highest from cust_order group by customer_id;

It will return maximum number of orders processed by the customers

by combining both

Find the customers, that who ordered highest number of orders