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 Labsql
Create a new database called cscilab
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 PersonPersonID
c Addresses AddressID PersonID, Street, City, State, ZipCode
i Primary Key: AddressID
ii Foreign Key: PersonID references PersonPersonID
Create the INSERT statements to add at least records into each table. The each record in Phones
and Addresses must point to a valid person.
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
