基本SQL SELECT语句.ppt

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

基本SQL SELECT语句 目标 通过本章学习,您将可以: 列举 SQL SELECT语句的功能。 执行简单的选择语句。 SQL 语言和 iSQL*Plus 命令的不同。 基本 SELECT 语句 SELECT 标识 选择哪些列。 FROM 标识从哪个表中选择。 选择全部列 选择特定的列 Writing SQL Statements SQL 语言大小写不敏感。 SQL 可以写在一行或者多行 关键字不能被缩写也不能分行 各子句一般要分行写。 使用缩进提高语句的可读性。 数学表达式 数字和日期使用的数学表达式。 使用数学运算符 操作符优先级 乘除的优先级高于加减。 同一优先级运算符从左向右执行。 括号内的运算先执行。 操作符优先级 使用括号 定义空值 空值是无效的,未指定的,未知的或不可预知的值。 空值不是空格或者0。 空值在数学运算中的使用 包含空值的数学表达式的值都为空值 列的别名 列的别名: 重命名一个列。 便于计算。 紧跟列名,也可以在列名和别名之间加入关键字‘AS’,以便再别名中包含空格或特殊的字符并区分大小写。 使用别名 连接符 连接符: 把列与列,列与字符连接在一起。 用 ‘||’表示。 可以用来‘合成’列。 使用连结操作 字符串 字符串可以是 SELECT 列表中的一个字符,数字,日期。 日期和字符只能在单引号中出现。 每当返回一行时,字符串被输出一次。 字符串 重复行 默认情况下,查询会返回全部行,包括重复行。 删除重复行 显示表结构 使用 DESCRIBE 命令,表示表结构 显示表结构 总结 Arithmetic Expressions You may need to modify the way in which data is displayed, perform calculations, or look at what-if scenarios. These are all possible using arithmetic expressions. An arithmetic expression can contain column names, constant numeric values, and the arithmetic operators. Arithmetic Operators The slide lists the arithmetic operators available in SQL. You can use arithmetic operators in any clause of a SQL statement except in the FROM clause. Instructor Note You can use the addition and subtraction operators only with DATE and TIMESTAMP data types. Using Arithmetic Operators The example in the slide uses the addition operator to calculate a salary increase of $300 for all employees and displays a new SALARY+300 column in the output. Note that the resultant calculated column SALARY+300 is not a new column in the EMPLOYEES table; it is for display only. By default, the name of a new column comes from the calculation that generated it—in this case, salary+300. Note: The Oracle9i server ignores blank spaces before and after the arithmetic operator. Operator Precedence If an arithmetic expression contains more than one operator, multiplication and division are evaluated first. If operators within an expression are of same priority, then evaluation is done from left to right. You can use

文档评论(0)

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

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

1亿VIP精品文档

相关文档