Question: Create a new SQL Script file in MySQL Workbench. Save the file as Lab 4 . sql 1 . Create a new database called csci

Create a new SQL Script file in MySQL Workbench. Save the file as Lab4.sql
1. Create a new database called csci5000lab4
2. Create the following tables:
a. Persons (PersonID, FirstName, LastName, Email)
i. Primary Key: PersonID
b. Phones (PhoneID, PersonID, AreaCode, PhoneNumber)
i. Primary Key: PhoneID
ii. Foreign Key: PersonID references Person(PersonID)
c. Addresses (AddressID, PersonID, Street, City, State, ZipCode)
i. Primary Key: AddressID
ii. Foreign Key: PersonID references Person(PersonID)
3. Create the INSERT statements to add at least 5 records into each table. The each record in Phones
and Addresses must point to a valid person.
4. Queries:
a. Write SELECT statements to retrieve data from each table.
b. Write an UPDATE statement to modify data in the Persons table.
c. Write a DELETE statement to remove data from the Addresses table.
d. Write INSERT statements to add data back into the Addresses table.
e. Write a DELETE statement to remove one record from the Phones table.
f. Write SELECT statements with a WHERE clause using comparison operators.
g. Write SELECT statements using ORDER BY

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!