Question: Insert the following into the client table: First Name Last Name Email Sara Smith smiths@hello.com Miguel Cabrera mc@hello.com Bo Chan'g bochang@hello.com Insert the following into
Insert the following into the client table:
| First Name | Last Name | |
|---|---|---|
| Sara | Smith | smiths@hello.com |
| Miguel | Cabrera | mc@hello.com |
| Bo | Chan'g | bochang@hello.com |
Insert the following into the employee table:
| First name | Last name | Start Date | |
|---|---|---|---|
| Ananya | Jaiswal | 4/10/2008 | ajaiswal@hello.com |
| Michael | Fern | 7/19/2015 | michaelf@hello.com |
| Abdul | Rehman | 2/27/2018 | rehman@hello.com |
Insert the following project instances into the project table (you should use a subquery to set up foreign key references and not hard-coded numbers):
| cid | title | comments |
|---|---|---|
| reference to Sara Smith | Diamond | Should be done by Jan 2019 |
| reference to Bo Chan'g | Chan'g | Ongoing maintenance |
| reference to Miguel Cabrera | The Robinson Project | NULL |
Insert the following into the works_on table. Again, your queries here should not have hard-coded integers for foreign keys.
| employee | project | due_date |
|---|---|---|
| Ananya Jaiswal | Chan'g | 11/19/2020 |
| Michael Fern | The Robinson Project | 12/05/2020 |
| Abdul Rehman | Diamond | 1/1/2021 |
Hints and Tips for Intermediate SQL Assignment
Hints and Tips for Advanced SQL Assignment A.1You are writing CREATE TABLE scripts following the instructions carefully. You also add constraints as well as indicating PKs and FKs. See examples here:http://www.mysqltutorial.org/mysql-foreign-key/(Links to an external site.) (Links to an external site.) A.2Start by inserting the values into the client and employee table. Remember the syntax is
INSERT INTO `table_name`(column_1,column_2,...) VALUES (value_1,value_2,...);
Next you will do an insert into the project table, but this time instead of writing the values for cid, you will use a SELECT subquery. So it might look something like this:
INSERT INTO project(cid, name, comments) VALUES ((SELECT id from client where first_name = 'Sara' and last_name = 'Smith'), 'Diamond', 'Should be done by Jan 2021'), (another SELECT subquery for Bo Chang), "Chan'g", 'Ongoing maintenance'), (another SELECT subquery for Miguel Cabrera), 'The Robinson Project', NULL)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
