Auto commit
This commit is contained in:
parent
d7bb147d7f
commit
c2fd89cd97
@ -33,5 +33,17 @@ ALTER TABLE customers_info DROP c_city;
|
||||
**2**
|
||||
|
||||
```sql
|
||||
#(1)创建表时 添加外键约束并指定外键约束名称
|
||||
CREATE TABLE orders(
|
||||
o_num INT(11) PRIMARY KEY AUTO_INCREMENT,
|
||||
o_date DATE,
|
||||
c_id INT(11),
|
||||
CONSTRAINT fk_cid FOREIGN KEY(c_id) REFERENCES customers_info(c_num)
|
||||
);
|
||||
#(2)
|
||||
#删除指定外键
|
||||
ALTER TABLE orders DROP FOREIGN KEY orders_ibfk_1;
|
||||
#删除指定表
|
||||
DROP TABLE orders;
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user