Database Reference
In-Depth Information
7.11 Write an ALTER statement to remove the column AreaCode from EMPLOYEE.
7.12 Write an ALTER statement to make Phone an alternate key in EMPLOYEE.
7.13 Write an ALTER statement to drop the constraint that Phone is an alternate key in
EMPLOYEE.
Create SQL scripts to answer Review Questions 7.14 through 7.19. Write the answer to
Review Question 7.18 as an SQL text comment, but include it in your script. Write the
answer to Review Question 7.19 as an SQL comment so that it cannot be run.
7.14 Write INSERT statements to add the data shown in Figure 1-27 to the DEPARTMENT
table. Run these statements to populate the DEPARTMENT table. (Hint: Write and test
an SQL script, and then run the script. Save the script as WPC-Insert-DEPARTMENT-
Data.sql for future use.)
7.15 Write INSERT statements to add the data shown in Figure 1-29 to the EMPLOYEE
table. Run these statements to populate the EMPLOYEE table. (Hint: Write and test an
SQL script, and then run the script. Save the script as WPC-Insert-EMPLOYEE-Data.sql
for future use.)
7.16 Write INSERT statements to add the data shown in Figure 2-31 to the PROJECT table.
Run these statements to populate the PROJECT table. (Hint: Write and test an SQL
script, and then run the script. Save the script as WPC-Insert-PROJECT-Data.sql for
future use.)
7.17 Write INSERT statements to add the data shown in Figure 2-33 to the ASSIGNMENT
table. Run these statements to populate the ASSIGNMENT table. (Hint: Write and test
an SQL script, and then run the script. Save the script as WPC-Insert-ASSIGNMENT-
Data.sql for future use.)
7.18 Why were the tables populated in the order shown in Review Questions 7.14 through 7.17?
7.19 Assume that you have a table named NEW_EMPLOYEE that has the columns
Department, Email, FirstName, and LastName, in that order. Write an INSERT state-
ment to add all of the rows from the table NEW_EMPLOYEE to EMPLOYEE. Do not
attempt to run this statement!
Create and run an SQL script named WPC -Update-Data.sql to answer Review
Questions 7.20 through 7.25. Write the answer to Review Question 7.25 as an SQL
comment so that it cannot be run.
7.20 Write an UPDATE statement to change the phone number of employee with
EmployeeNumber 11 to 360-287-8810. Run this SQL statement.
7.21 Write an UPDATE statement to change the department of employee with
EmployeeNumber 5 to Finance. Run this SQL statement.
7.22 Write an UPDATE statement to change the phone number of employee with
EmployeeNumber 5 to 360-287-8420. Run this SQL statement.
7.23 Combine your answers to Review Questions 7.21 and 7.22 into one SQL statement. Run
this statement.
7.24 Write an UPDATE statement to set the HoursWorked to 60 for every row in
ASSIGNMENT having the value 10 for EmployeeNumber. Run this statement.
7.25 Assume that you have a table named NEW_EMAIL, which has new values of Email for
some employees. NEW_EMAIL has two columns: EmployeeNumber and NewEmail.
Write an UPDATE statement to change the values of Email in EMPLOYEE to those in
the NEW_EMAIL table. Do not run this statement.
Search WWH ::




Custom Search