Auto commit
This commit is contained in:
parent
88350396ba
commit
1ba7f30de6
@ -114,5 +114,25 @@ CREATE TABLE salary(
|
||||
#3添加外键并设置级联更新、级联删除
|
||||
ALTER TABLE salary ADD CONSTRAINT fk_sal_eid FOREIGN KEY(empid)
|
||||
REFERENCES employee(empid) ON UPDATE CASCADE ON DELETE CASCADE;
|
||||
#4插入记录
|
||||
INSERT INTO department()
|
||||
VALUES
|
||||
(111, '生产部', NULL),
|
||||
(222, '销售部', NULL),
|
||||
(333, '人事部', NULL);
|
||||
|
||||
INSERT INTO employee()
|
||||
VALUES
|
||||
(1001, '张三', '男', '高级工程师', '1975-1-1', 111),
|
||||
(1002, '李四', '女', '助工', '1985-1-1', 111),
|
||||
(1003, '王五', '男', '工程师', '1978-11-11', 222),
|
||||
(1004, '赵六', '男', '工程师', '1999-1-1', 222);
|
||||
|
||||
INSERT INTO salary()
|
||||
VALUES
|
||||
(1001, 2200, 1100, 200),
|
||||
(1002, 1200, 200, NULL),
|
||||
(1003, 2900, 700, 200),
|
||||
(1004, 1950, 700, 150);
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user