CREATE TABLE department ( DepartmentID INT, DepartmentName VARCHAR(20) ); CREATE TABLE employee ( LastName VARCHAR(20), DepartmentID INT ); INSERT INTO department(DepartmentID, DepartmentName) VALUES(31, 'Sales'); INSERT INTO department(DepartmentID, DepartmentName) VALUES(33, 'Engineering'); INSERT INTO department(DepartmentID, DepartmentName) VALUES(34, 'Clerical'); INSERT INTO department(DepartmentID, DepartmentName) VALUES(35, 'Marketing'); INSERT INTO employee(LastName, DepartmentID) VALUES('Rafferty', 31); INSERT INTO employee(LastName, DepartmentID) VALUES('Jones', 33); INSERT INTO employee(LastName, DepartmentID) VALUES('Steinberg', 33); INSERT INTO employee(LastName, DepartmentID) VALUES('Robinson', 34); INSERT INTO employee(LastName, DepartmentID) VALUES('Smith', 34); INSERT INTO employee(LastName, DepartmentID) VALUES('John', NULL);
搜尋此網誌
2013年7月31日 星期三
【SQL】使用Create指令
如何建立如右二表?
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言