- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Chapter 8 SQL-99: Schema Definition, Basic Constraints, and Queries Data Definition, Constraints, and Schema Changes Used to CREATE, DROP, and ALTER the descriptions of the tables (relations) of a database CREATE TABLE Specifies a new base relation by giving it a name, and specifying each of its attributes and their data types (INTEGER, FLOAT, DECIMAL(i,j), CHAR(n), VARCHAR(n)) A constraint NOT NULL may be specified on an attributeCREATE TABLE DEPARTMENT ( DNAME VARCHAR(10) NOT NULL, DNUMBER INTEGER NOT NULL, MGRSSN CHAR(9), MGRSTARTDATE CHAR(9) ); CREATE TABLE In SQL2, can use the CREATE TABLE command for specifying the primary key attributes, secondary keys, and referential integrity constraints (foreign keys). Key attributes can be specified via the PRIMARY KEY and UNIQUE phrases CREATE TABLE DEPT ( DNAME VARCHAR(10) NOT NULL, DNUMBER INTEGER NOT NULL, MGRSSN CHAR(9), MGRSTARTDATE CHAR(9), PRIMARY KEY (DNUMBER), UNIQUE (DNAME), FOREIGN KEY (MGRSSN) REFERENCES EMP ); DROP TABLE Used to remove a relation (base table) and its definition The relation can no longer be used in queries, updates, or any other commands since its description no longer exists Example:DROP TABLE DEPENDENT; ALTER TABLE Used to add an attribute to one of the base relations The new attribute will have NULLs in all the tuples of the relation right after the command is executed; hence, the NOT NULL constraint is not allowed for such an attribute Example:ALTER TABLE EMPLOYEE ADD JOB VARCHAR(12); The database users must still enter a value for the new attribute JOB for each EMPLOYEE tuple. This can be done using the UPDATE command. Features Added in SQL2 and SQL-99 CREATE SCHEMA REFERENTIAL INTEGRITY OPTIONS CREATE SCHEMA Specifies a new database schema by giving it a name REFERENTIAL INTEGRITY OPTIONS We can specify RESTRICT, CASCADE, SET NULL or SET DEFAULT on referential integrity constraints (foreign keys)CREATE TABLE DEPT ( DNAME VARCHAR(10) NOT NU
您可能关注的文档
- §11.3 简谐运动的回复力和能量.ppt
- 英语:unit1 Women of achievement-reading课件(新人教版必修4).ppt
- 《管理信息系统——理论与实践》课件——第1章 信息、 系统与管理[管理资料].ppt
- 2009届高考数学研讨会解题思路资料(答题相约).ppt
- CH6不同条件下的企业战略选择.ppt
- 3第三章 债务重组[资本运营管理].ppt
- Accretion (last updated 20056) - UCL:吸积(最后更新20056)-伦敦大学学院.ppt
- MBA运营管理-9项目型生产计划【企业经营管理推荐】.ppt
- Social Issues of the Progressive Era - Washington State 社会问题的进步时代,华盛顿州.ppt
- 公共关系与艺术实践课程复习【企业营销策划经典】.ppt
- 写作基础 山大版.ppt
- 第7章 固定资产管理子系统[资本运营管理].ppt
- 大学应用统计学经典课件09——相关与回归分析_图文.ppt
- NEW HOPE FOR CHILDREN AND ADULTS WITH ADDADHD与addadhd儿童和成人的新希望.ppt
- (苏教版生物)2012届高三一轮《创新设计》课件:选3-1《现代生物科技专题》.ppt
- 征兵宣传-信息工程学院-2012.10.21.ppt
- 高中心理学课件(小学涵盖).ppt
- 2012年《随堂优化训练》历史 人民版 必修二 专题七 第3课 苏联社会主义改革与挫折.ppt
- 大学生职业生涯规划03922.ppt
- NCLB Program MonitoringNCLB计划监测.ppt
文档评论(0)