Previous Topic: Review Answers for Chapter 7Next Topic: Table Descriptions


Review Answers for Chapter 8

Exercise 8-1 Answer

This is the answer for Exercise 8-1.

insert into department
       values (6060, null, 'D09', 'Claims');
select *

from department
order by dept_id;

Exercise 8-2 Answer

This is the answer for Exercise 8-2.

insert into department

values (dept_id, null, 'div_code', 'dept_name');

insert into department
values (dept_id, null, 'div_code', 'dept_name');

select *
from department
order by dept_id;

Exercise 8-3 Answer

This is the answer for Exercise 8-3.

insert into project (proj_id, proj_desc)
       values ('P434', 'Mass Media Campaign Blitz');
select proj_id, proj_desc

from project
order by proj_id;

Exercise 8-4 Answer

This is the answer for Exercise 8-4.

select emp_id, vac_accrued

from benefits
where fiscal_year = 2000
order by emp_id;

Exercise 8-5 Answer

This is the answer for Exercise 8-5.

update department
       set dept_name = 'Lost Claims'
       where dept_id = 6060;
select dept_id, dept_name

from department
where dept_id = 6060;

Exercise 8-6 Answer

This is the answer for Exercise 8-6.

update employee
       set dept_id = 6200
       where emp_id = 3433;
select emp_id, dept_id

from employee
where emp_id = 3433;

Exercise 8-7 Answer

This is the answer for Exercise 8-7.

update employee
       set city = 'Framingham'
       where emp_id in (1034, 3704, 4660);
select emp_id, city

from employee
where emp_id in (3433, 8377, 1034);

Exercise 8-8 Answer

This is the answer for Exercise 8-8.

delete from department
       where dept_id = 5050;
select *

from department
order by dept_id;

Exercise 8-9 Answer

This is the answer for Exercise 8-9.

delete from department
       where dept_id = 6060;
select *

from department
order by dept_id;

Review Answers

These are the answers for Review.

  1. You use a SELECT statement with INSERT to:
  2. If you don't have a value for every column you are adding to a table, you can:
  3. You can update all rows in a table by:
  4. You can update selected rows in a table by:
  5. You are updating all columns in a table but do not know the specific value to put into one column. You can:
  6. If you do not have a WHERE clause in a DELETE statement: