课题_天蝎机柜服务器技术规范25版

上传人:xmg****18 文档编号:117098903 上传时间:2019-11-18 格式:PPT 页数:33 大小:699.13KB
返回 下载 相关 举报
课题_天蝎机柜服务器技术规范25版_第1页
第1页 / 共33页
课题_天蝎机柜服务器技术规范25版_第2页
第2页 / 共33页
课题_天蝎机柜服务器技术规范25版_第3页
第3页 / 共33页
课题_天蝎机柜服务器技术规范25版_第4页
第4页 / 共33页
课题_天蝎机柜服务器技术规范25版_第5页
第5页 / 共33页
点击查看更多>>
资源描述

《课题_天蝎机柜服务器技术规范25版》由会员分享,可在线阅读,更多相关《课题_天蝎机柜服务器技术规范25版(33页珍藏版)》请在金锄头文库上搜索。

1、Copyright 2004, Oracle. All rights reserved. 天蝎机柜服务器技术规范2.5版 After completing this lesson, you should be able to do the following: Limit the rows that are retrieved by a query Sort the rows that are retrieved by a query Use ampersand substitution in iSQL*Plus to restrict and sort output at run time

2、Objectives Limiting Rows Using a Selection “retrieve all employees in department 90” EMPLOYEES Restrict the rows that are returned by using the WHERE clause: The WHERE clause follows the FROM clause. Limiting the Rows That Are Selected SELECT *|DISTINCT column|expression alias,. FROM table WHERE con

3、dition(s); SELECT employee_id, last_name, job_id, department_id FROM employees WHERE department_id = 90 ; Using the WHERE Clause SELECT last_name, job_id, department_id FROM employees WHERE last_name = Whalen ; Character strings and date values are enclosed by single quotation marks. Character value

4、s are case-sensitive, and date values are format-sensitive. The default date format is DD-MON-RR. Character Strings and Dates Comparison Conditions OperatorMeaning =Equal to Greater than =Greater than or equal to = 10000 OR job_id LIKE %MAN% ; Using the OR Operator OR requires either condition to be

5、 true: SELECT last_name, job_id FROM employees WHERE job_id NOT IN (IT_PROG, ST_CLERK, SA_REP) ; Using the NOT Operator Rules of Precedence You can use parentheses to override rules of precedence. OperatorMeaning 1Arithmetic operators 2Concatenation operator 3Comparison conditions 4IS NOT NULL, LIKE

6、, NOT IN 5NOT BETWEEN 6Not equal to 7NOT logical condition 8 AND logical condition 9 OR logical condition SELECT last_name, job_id, salary FROM employees WHERE job_id = SA_REP OR job_id = AD_PRES AND salary 15000; Rules of Precedence SELECT last_name, job_id, salary FROM employees WHERE (job_id = SA

7、_REP OR job_id = AD_PRES) AND salary 15000; 1 2 Sort retrieved rows with the ORDER BY clause: ASC: ascending order, default DESC: descending order The ORDER BY clause comes last in the SELECT statement: Using the ORDER BY Clause SELECT last_name, job_id, department_id, hire_date FROM employees ORDER

8、 BY hire_date ; Sorting in descending order: Sorting by column alias: Sorting by multiple columns: Sorting SELECT last_name, job_id, department_id, hire_date FROM employees ORDER BY hire_date DESC ; 1 SELECT employee_id, last_name, salary*12 annsal FROM employees ORDER BY annsal ; 2 SELECT last_name

9、, department_id, salary FROM employees ORDER BY department_id, salary DESC; 3 Substitution Variables . salary = ? department_id = ? . last_name = ? . I want to query different values. Use iSQL*Plus substitution variables to: Temporarily store values with single-ampersand ( Use a variable prefixed wi

10、th an ampersand ( Use single quotation marks for date and character values: Character and Date Values with Substitution Variables Specifying Column Names, Expressions, and Text SELECT employee_id, last_name, job_id, salary salary 15000 last_name SELECT employee_id, last_name, job_id, Use the double

11、ampersand ( UNDEFINE employee_num old 3: WHERE employee_id = Use the VERIFY command to toggle the display of the substitution variable, both before and after iSQL*Plus replaces substitution variables with values: Using the VERIFY Command SELECT *|DISTINCT column|expression alias,. FROM table WHERE c

12、ondition(s) ORDER BY column, expr, alias ASC|DESC ; In this lesson, you should have learned how to: Use the WHERE clause to restrict rows of output: Use the comparison conditions Use the BETWEEN, IN, LIKE, and NULL conditions Apply the logical AND, OR, and NOT operators Use the ORDER BY clause to so

13、rt rows of output: Use ampersand substitution in iSQL*Plus to restrict and sort output at run time Summary This practice covers the following topics: Selecting data and changing the order of the rows that are displayed Restricting rows by using the WHERE clause Sorting rows by using the ORDER BY clause Using substitution variables to add flexibility to your SQL SELECT statements Practice 2: Overview 知识回顾知识回顾 Knowledge Knowledge ReviewReview

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 大杂烩/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号