Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

- - # 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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions