Question: - - # 1 Add a statement below to DROP the database if it exists - - # 2 Add a statement below to CREATE

-- #1 Add a statement below to DROP the database if it exists
-- #2 Add a statement below to CREATE the database
-- #3 Add a statement to USE the database
-- class table statementCREATE TABLE IF NOT EXISTS grades.class (
class_id INT NOT NULL AUTO_INCREMENT,
department_code CHAR(4) NULL,
course_number INT NULL,
course_section CHAR(4) NULL,
course_name VARCHAR(100) NULL,
academic quarter CHAR(2) NULL,
academic_year INT NULL,
PRIMARY KEY (class_id)
:
INSERT INTO grades.class (department_code, course_number, course_section,
course_name, academic_quarter, academic_year)
VALUES ('INFO','1335','WW', 'Full Stack App Development', 'FA','2023');
----
CREATE TABLE IF NOT EXISTS grades.assignment (
grade_id INT NOT NULL AUTO_INCREMENT,
task_me VARCHAR(100) NULI,
points_earned INT NOT NULL,
points_possible INT NOT NULL,
class_id INT NOT NULL,
PRIMARY KEY (grade id),
CONSTRAINT fk_assignment_class
FOREIGN KEY (class_id) REFERENCES class (class_id)
-- grant priviledges for mgs user ----------------------------
GRANT DELETE, INSERT, SELECT, UPDATE ON grades.* TO mgs_user@localhost;Part 2: Insert records into the database
Note: All SQL statements you write in MySQL Workbench should be collected in one script file, with each statement ending with semi-colons ( ; ). Later, you will submit this
script file as a deliverable for the final project.
B. Write SQL to insert two more classes into the class table.
Note: You can do this using one INSERT INTO statement, or multiple INSERT INTO statements. Either way works. Just make sure to add a semi-colon (; ) on the end of each
statement. Remember, the class primary keys are automatically generated for you via the auto-increment column attribute.
C. Write a SELECT statement that returns all columns and rows in the class table.
Note: You'll want to be sure to highlight only this SELECT statement and click on
otherwise you'll enter more classes into the class table. Be sure to make note of the
returned class_id values for the classes in the table. You will need them when you write SQL to insert assignments.
D. Write SQL to insert at least eight assignments into the assignment table.
Note: You'll want to be sure to highlight only your assignment INSERT INTO statement(s) and click on otherwise you'll insert more classes into the class table. You only need
a minimum of eight assignments in total in the assignments table, but there should be at least two assignments for each class in the class table. Remember, the assignment
primary keys are automatically generated for you via the auto-increment column attribute.
E. Write a SELECT statement that returns all columns and rows in the assignments table.
Note: You'll want to be sure to highlight only this SELECT statement and click on
otherwise you'll enter more classes and assignments into the tables.
F. Save your SQL Script by selecting File > Save Script As... from the menu. Name your script myInsertScript.
 -- #1 Add a statement below to DROP the database if

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!