- 1、本文档共14页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
数据库例题(Database example)
7-4 BookInfo表
(
b_id varchar(16)不为空,
b_name varchar(50)不为空,
bt_id char(10)不为空,
b_author varchar(20)不为空,
b_translator varchar(20)空,
b_isbn varchar(30)不为空,
p_id char(4)不为空,
b_date日期不为空,
b_edition SmallInt NOT NULL默认1,
b_price钱不空,
b_quantity SmallInt不空,
b_detail varchar(100)零违约”暂无描述”,
b_picture图像空
)
插入BookInfo(b_id,b_name,bt_id,b_author,b_translator,b_isbn,p_id,b_date,b_price,b_quantity)
值(tp3 / 2999 ,测试默认值’,’17”、“默认值,无,7-03-015754-0 ,007 ,2009-4-1 ,29.00,14)
SELECT * FROM BookInfo哪里b_name = 测试默认值”
7-6修改表和添加约束ck_quantity BookInfo NOCHECK检查(b_quantity = 1和b_quantity = 100)
7-8 BookInfo表
(
b_id varchar(16)主键,
b_name varchar(50)不为空,
bt_id char(10)不为空,
b_author varchar(20)不为空,
b_translator varchar(20)空,
b_isbn varchar(30)不为空,
p_id char(4)不为空,
b_date日期不为空,
b_edition SmallInt NOT NULL默认1,
b_price钱不空,
b_quantity SmallInt不空,
b_detail varchar(100)零违约”暂无描述”,
b_picture图像空
)
创建表borrowreturn
(-- br_id char(6)不为空,--借阅编号
s_id char(8)不为空,--条型码
r_id char(8)不为空,--借书证编号
br_outdate日期不为空,--借书日期
br_indate DateTime空,--还书日期
br_lostdate DateTime空,--挂失日期
br_times字段为空,--续借次数
br_operator varchar(10)不为空,--操作员
br_status varchar(4)不为空,图书状态
pk_borrowreturn主键约束(s_id,
R_ID)
)
7-10 -- there is no primary key or candidate key that matches the list of reference columns of the foreign keyFK__BookInfo__bt_ID__398D8EEEin the referenced tableBookType.
Create table BookInfo
(
B_ID varchar (16) primary key,
B_Name varchar (50) NOT NULL,
Bt_ID char (10) REFERENCES BookType (bt_ID),
B_Author varchar (20) not null,
B_Translator varchar (20) NULL,
B_ISBN varchar (30) NOT NULL,
P_ID char (4) NOT NULL,
B_Date datetime NOT NULL,
B_Edition smallint NOT NULL default 1,
B_Price money NOT NULL,
B_Quantity smallint NOT NULL,
B_Detail varchar (100) NULL defaultno description,
B_Picture image NULL
)
7-11 create table BookInfo
(
B_ID varchar (16) primary key,
B_Name varchar (50) unique,
Bt_ID char (10) REFERENCES BookType (bt_ID),
B_Author varchar (20) not null,
B_Translator varchar (20) NULL,
B_ISBN
您可能关注的文档
- 我的工作体会(My work experience).doc
- 我的黑屏故障分析(My black screen fault analysis).doc
- 我的教案(My lesson plan).doc
- 我的课改故事(My class changes the story).doc
- 我的青春(My youth).doc
- 我的理财生活-通向财务自由之路(My financial life - to financial The Freedom Trail).doc
- 我的叔叔于勒 续写(My uncle Jules writing).doc
- 我的小学作文课(My primary school composition lesson).doc
- 我的学车故事(My story starts).doc
- 我的载体构建心得(My carrier construction experience).doc
文档评论(0)