Auto commit

This commit is contained in:
smallkun 2025-03-14 08:53:36 +08:00
parent d7bb147d7f
commit c2fd89cd97

View File

@ -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;
```