Answered step by step
Verified Expert Solution
Link Copied!

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 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

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

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions