第四章SQL语言.pptVIP

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
JDBC驱动程序类型 用SQL 写查询并为它声明一个游标 EXEC SQL declare c cursor for select customer-name, customer-city from depositor, customer, account where depositor.customer-name = customer.customer-name and depositor account-number = account.account-number and account.balance :amount END-EXEC 从宿主语言内查询在某账户中余额大于给定变量amount 的客户的姓名和城市. Select customer_name From borrower Where exists (select * from depositor where depositor.customer_name=borrower.customer_name) 集合操作: in, not in, some/all, =some/all, =some/all, some/all, exists, not exists, unique,not unique 查询语句: SELECT [DISTINCT] Attributes list FROM relations list [WHERE predicate ] [GROUP BY Attributes list [ HAVING Attributes list ] ] [ORDER BY Attribute [ASC|DESC],…, Attribute [ASC|DESC] ]; 关系模式 属性域 完整性约束 关系的索引 关系的安全性和授权信息 关系在磁盘上的物理存储结构 不仅可以声明关系, 还可以声明关系的其他信息, 包括: 2 数据定义DDL 关系/基表 SQL 关系用create table 命令定义: create table r (A1 D1, A2 D2, ..., An Dn, (integrity-constraint1), ..., (integrity-constraintk)) r 是关系名 Ai 是属性名 Di 是属性Ai 的域值的数据类型 例如: create table branch (branch-name char(15) not null, branch-city char(30), assets integer) not null primary key (A1, ..., An) Foreign Key (A1,…,An) reference table r on delete restrict/cascade/set NULL check (P), where P 是谓词 create table account (account_number char(10), branch_name char(15), balance integer, primary key (account_number), foreign key (branch_name) references branch) check (balance = 0)) char(n). 定长字符串, 用户指定长度 n. varchar(n). 变长字符串, 用户指定最大长度 n. int. 整数 (依赖于机器的有限整数集合). smallint. 小整数 (依赖于机器的有限整数集合). numeric(p,d). 定点数, 用户指定精度为 p 位, 小数点右边有 n 位. real, double precision. 浮点数和双精度浮点数, 精度依赖于机器. float(n). 浮点数, 用户指定精度为至少n 位. 域类型中允许空值. 声明一个属性为 not null 将禁止该属性取空值. SQL-92中的create domain 语句可创建用户定义的域类型 create domain person-name char(20) not null SQL域类型: date. 日期, 包含年(4 位) , 月, 日 E.g. date ‘2001-7-27’ time. 一天中的时间, 包含小时, 分钟, 秒 E.g. time ’09:00:30’ time ’09:00:30.75’ timestamp: 日期加时间 E.g. timestamp ‘2001-7

文档评论(0)

gk80333 + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档