Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started