Chinaunix首页 | 论坛 | 博客
  • 博客访问: 135674
  • 博文数量: 255
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2916
  • 用 户 组: 普通用户
  • 注册时间: 2018-07-05 13:59
个人简介

Oracle dba培训、OCP、OCM、MYSAL认证,可以找我们,cuug专业做这些

文章分类

全部博文(255)

文章存档

2019年(217)

2018年(38)

我的朋友

分类: Oracle

2019-11-19 09:58:55

choose three

Examine this SQL statement:

SELECT cust_id, cus_ last_name "Last Name"

FROM customers

WHERE country_id = 10

UNION

SELECT cust_id CUST_NO, cust_last_name

FROM customers

WHERE country_id = 30

Identify three ORDER BY clauses, any one of which can complete the query successfully.

A) ORDERBY 2, 1

B) ORDER BY "CUST_NO"

C) ORDER BY 2,cust_id

D) ORDER BY CUST_NO

E) ORDER BY "Last Name"

Answer:ACE

(解析:此题的解析跟下面的解析一样,答案就是按照解析的总结规律找出来的。)

071-140 题目:

SELECT department_id "DEPT_ID", department_name, 'b' FROM departments

WHERE department_id=90 UNION

SELECT department_id, department_name DEPT_NAME, 'a' FROM departments

WHERE department_id=10

Which two ORDER BY clauses can be used to sort output?

A. ORDER BY DEPT_NAME;

B. ORDER BY DEPT_ID;

C. ORDER BY 'b';

D. ORDER BY 3;

Correct Answer: BD

(解析:通过实验发现别名必须是用双引号概括起来的才可以用来排序;而且发现取了别名(别名用双引号概括)的列的名字也不能用来排序;没有用双引号概括起来的别名的列名可以用来排序;order by 3,可以根据显示的列的顺序进行排序。

注意 union 排序的的时候 order by 要写在语句的最后;发现只能在第一条 select 语句中的列进行排序。)

SQL> select empno "CUST_NO",ename "LAST NAME",'a' FROM emp

2 UNION

3 SELECT EMPNO ,ENAME,'b' FROM emp

4 ORDER BY empno;

ORDER BY empno

*

第 4 行出现错误:

ORA-00904: "EMPNO": 标识符无效

阅读(19) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册