2010年5月28日 星期五

SQL2008-隨堂練習(5)

1.將emp資料表中的comm欄位的值是null的改為0(P272)
update emp
set comm=0
where comm is null

2.在emp資料表中將research部門的員工調薪5%
update emp 
set sal=sal*1.05
where deptno= ( select deptno from dept where danme='research')

3.

  • 在ord資料表中,將訂單編號'620'的訂單刪除
  • 在item資料表中,將訂單編號'620'的訂購記錄刪除
  • 重新執行第一題
select *from ord where ordid=620
go
select*from item where ordid=620
go
delete from ord
where ordid=620
go
delete from item
where ordid=620


4.在item資料表中,將客戶編號'106'的訂購記錄刪除
delete from item
where ordid in (select ordid from ord where custid=106)
                  

沒有留言:

張貼留言