- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
创建主键、外键和唯一约束(Create primary keys, foreign keys, and unique constraints)
创建主键、外键和唯一约束(Create primary keys, foreign keys, and unique constraints)
The code that creates primary keys, foreign keys, and unique constraints in Oracle
Oracle. first create the student information sheet studentinfo and the student achievement form testinfo.
- student information sheet
CREATE, TABLE, studentInfo
StuNo CHAR (10) NOT NULL,
StuName VARCHAR2 (20) NOT NULL,
StuSex NUMBER (1),
StuBirthday DATE DEFAULT SYSDATE,
StuAddress VARCHAR2 (20)
);
- student achievement form
CREATE, TABLE, testInfo
StuNo CHAR (10) NOT NULL,
ClassNo CHAR (5) NOT NULL,
TestScore NUMBER (3,1)
);
- constraints: sets the primary key
Alter, table, testInfo, add, constraint, fk_1, foreign, key (stuNo), references, studentinfo (stuNo);
- constraints: set foreign keys
Alter, table, studentinfo, add, constraint, pk_1, primary, key (stuNo);
- constraints: set unique
Alter, table, testInfo, add, constraint, uniq_1, unique (stuNo, classno);
-- insert test data
INSERT, INTO, STUDENTINFO, VALUES (001,ZHANGSAN, 1,03-1, -86,, Xuanwu District, Nanjing);
INSERT, INTO, STUDENTINFO, VALUES (002,LISI, 1,05-12, -86,, Xuanwu District, Nanjing);
INSERT INTO STUDENTINFO VALUES (003,WANGWU, 0,03-10 -85, Nanjing Baixia District );
INSERT, INTO, STUDENTINFO, VALUES (004,ZHANGSAN, 1,23-10, -88,, Xiaguan District, Nanjing);
INSERT, INTO, STUDENTINFO, VALUES (005,SMITH, 0,31-10, -89,, Xuanwu District, Nanjing);
INSERT, INTO, STUDENTINFO, VALUES (006,ALLEN, 1,25-12, -86, Nanjing, Qixia);
INSERT, INTO, STUDENTINFO, VALUES (007,SCOTT, 1,08-11, -86, Nanjing, Pukou);
INSERT, INTO, STUDENTINFO, VALUES (008,BRUCE, LEE, 0,03-11, -80, Yuhua District);
INSERT, INTO, STUDENTINFO, VALUES (009,BRUCE, LEE, 1,09-12, -87, Nanjing, Liuhe);
INSERT, INTO, STUDENTINFO, VALUES (010,ZHANGSAN, 1,13-11, -82,, Xuanwu District, Nanjing);
INSERT, INTO, TESTINFO, VALUES (001,02, 90.5);
INSERT, INTO, TESTINFO, VALUES (001,01, 80);
INSERT, INTO, TESTINFO, VALUES (001,03, 60);
INSERT, INTO, TESTINFO, VALUES (001,04, 50);
INSERT, INTO, TESTINF
您可能关注的文档
- 从销售漏斗剖析网络营销的剧痛(Analysis of the pain of network marketing from sales funnel).doc
- 从零开始学炒股(Start learning stocks from scratch).doc
- 仓库管理水平问题分析(Analysis of warehouse management level).doc
- 仙剑奇侠传4做所有支线和委托任务的顺序(The Legend of Sword and Fairy 4 line and do all the tasks entrusted to the order).doc
- 仙剑三所有迷宫详细走法(Immortal sword three, all maze detailed method).doc
- 从彼得原理浅谈企业培训工作新思路(Discussion on the new train of thought of enterprise training from Peter's principle).doc
- 仙剑奇侠传三攻略20141216(Legend of Sword and Fairy three Raiders 20141216).doc
- 从物权法看小区车位归属权问题(The ownership of parking spaces in residential areas from the perspective of property law).doc
- 代工企业的弯道挑战(OEM corner challenge).doc
- 代理产品策略决定成败(Agency product strategy determines success or failure).doc
- 创业策划6(Business plan 6).doc
- 创建感悟式教学模式doc - 江南中学(Creating a perception teaching model doc - Jiangnan middle school).doc
- 列强退还的庚子赔款及用途(The Boxer Indemnity refund purposes and powers).doc
- 创新创业典型案例集6-10(Typical cases of innovation and entrepreneurship 6-10).doc
- 创新来自有组织无纪律(Innovation comes from being organized without discipline).doc
- 创新是幸福商业的动力(Innovation is the driving force of a happy business).doc
- 创新烟草企业可持续发展的根本保证(Innovation the fundamental guarantee for the sustainable development of tobacco enterprises).doc
- 创新的持久动力(The lasting motive force of innovation).doc
- 创新监督模式 完善监督程序(Innovate supervision model and perfect supervision procedure).doc
- 出境游知识(Outbound travel knowledge).doc
最近下载
- TBNCY002-2023 西双版纳红茶 晒红茶.pdf VIP
- 机关单位人力资源管理中存在的问题及解决对策.docx VIP
- 2025年中级(四级)营销员职业技能鉴定《理论知识》真题卷(后附答案及解析).pdf VIP
- 大数据概论教学课件.pptx VIP
- 西双版纳红茶 晒红茶.docx VIP
- 室内装修全工程施工方案(3篇).docx VIP
- 2025年卫生事业单位招聘考试(中医学基础知识)历年参考题库含答案详解(5卷).docx VIP
- 50个广告分析.doc VIP
- GB32030-2022 潜水电泵能效限定值及能效等级 (2).pdf VIP
- (语文)福州时代中学2020级初一新生入学检测.pdf VIP
文档评论(0)