设计一张SQL部门表
CREATE TABLE department ( department_id INT PRIMARY KEY, department_name VARCHAR(50) NOT NULL, manager_id INT, location_id INT, FOREIGN KEY (manager_id) REFERENCES employee(employee_id), FOREIGN KEY (location_id) REFERENCES location(location_id) );
注解:
- department_id:部门ID,是主键;
- department_name:部门名称,不能为空;
- manager_id:部门经理的员工ID,可以为空;
- location_id:部门所在地的ID,可以为空;
- manager_id和location_id都是外键,分别引用了员工表和地点表的主键。
原文地址: https://www.cveoy.top/t/topic/KPL 著作权归作者所有。请勿转载和采集!