1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
ch5-SQL_1

Chapter3 SQL Chapter 5: SQL Contents Basic Query Structure Set Operations Aggregate Functions Null Values Nested Subqueries Complex Queries History IBM Sequel language developed as part of System R project at the IBM San Jose Research Laboratory Renamed Structured Query Language (SQL) ANSI and ISO standard SQL: SQL-86, SQL-89, SQL-92, SQL:1999, SQL:2003 History Commercial systems offer most, if not all, SQL-92 features, plus varying feature sets from later standards and special proprietary features. Not all examples here may work on your particular system SQL Features Non procedure Simple core functionality is only used nine words 综合统一 集数据定义语言(DDL),数据操纵语言(DML),数据控制语言(DCL)功能于一体。 可以独立完成数据库生命周期中的全部活动: ? 定义关系模式,插入数据,建立数据库; ? 对数据库中的数据进行查询和更新; ? 数据库重构和维护 ? 数据库安全性、完整性控制等 Basic Query Structure SQL is based on relational algebra and relational calculus A typical SQL query has the form: Basic Query Structure equivalent to the relational algebra expression The result of an SQL query is a relation Note: for our examples we use the tables: Branch (branch-name, branch-city, assets) Customer (customer-name, customer-street, customer-city) Loan (loan-number, amount, branch-name) Account (account-number, balance, branch-name) Borrower (customer-name, loan-number) Depositor (customer-name, account-number) The select Clause The select clause list the attributes desired in the result of a query corresponds to the projection operation of the relational algebra The select Clause SQL names are case insensitive (i.e., you may use upper- or lower-case letters.) Duplicate Removal SQL allows duplicates in relations as well as in query results. Use select distinct to force the elimination of duplicates. Find the names of all branches in the loan relation, and remove duplicates select distinct branch-name from loan The keyword all specifies that duplicates are not removed. select all branch-name from loan Duplicate Removal 注意:distinct 作用于所有的目标列 select distinct branch

文档评论(0)

sd44055 + 关注
实名认证
内容提供者

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

1亿VIP精品文档

相关文档