美文网首页
数据库 (相关练习)

数据库 (相关练习)

作者: 定格r | 来源:发表于2018-11-01 20:54 被阅读0次

1.设置约束条件 check

(不是 A 就是 B)

check(属性名 in (A,B))

2.设置外键

 primary key(联合主键属性名1,联合主键属性名2) ,
 foreign   key(联合主键属性名1) references 参照表名(参照属性名),
foreign   key(联合主键属性名2) references 参照表名(参照属性名),

3.查出来一张表数据插入到另一张表

insert into cart(book_id,book_name,book_image) 
select book_id,book_name,book_image 
from book where book_id = 1;

相关文章

网友评论

      本文标题:数据库 (相关练习)

      本文链接:https://www.haomeiwen.com/subject/ackfxqtx.html