21 lines
646 B
Plaintext
21 lines
646 B
Plaintext
/*
|
|
擴充 Northwind 定義不足之處, 配合進階 SQL 語法使用
|
|
擴充後為完整的 DB
|
|
*/
|
|
|
|
-- 部門檔
|
|
create table Department (
|
|
DepartmentID varchar(4) not null,
|
|
DepartmentName nvarchar(20) not null,
|
|
ManagerID int, -- 部門主管
|
|
primary key(DepartmentID)
|
|
);
|
|
|
|
insert into Department (DepartmentID,DepartmentName,ManagerID) Values ('A1','總管理處',1),('S1','北區業務部',2),('S2','南區業務部',3);
|
|
|
|
-- 員工薪資
|
|
Alter Table Employees Add DepartmentID varchar(4);
|
|
Alter Table Employees Add Salary int;
|
|
|
|
update Employees set DepartmentID = '', Salary = 10000 where EmployeeID = 1;
|
|
update Employees set DepartmentID = '', Salary = 10000 where EmployeeID = 2; |