JAVA全系列 教程
3762个小节阅读:7093.9k
目录
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
在一个不明确的查询结果中排序返回的行。ORDER BY 子句用于排序。如果使用了 ORDER BY 子句,它必须位于 SQL 语句的最后。
SELECT 语句的执行顺序如下:
示例一:
查询 employees 表中的所有雇员,显示他们的ID、名字与薪水,并按薪水升序排序。
xxxxxxxxxx
select employee_id,last_name,salary from employees order by salary;
select employee_id,last_name,salary from employees order by salary asc;
示例二:
查询 employees 表中的所有雇员,显示他们的ID与名字,并按雇员名字降序排序。
xxxxxxxxxx
select employee_id,last_name from employees order by last_name desc;
示例:
显示雇员ID,名字。计算雇员的年薪,年薪列别名为annsal,并对该列进行升序排序,
xxxxxxxxxx
select employee_id,last_name ,12*salary annsal from employees order by annsal;
示例:
以升叙排序显示 DEPARTMENT_ID 列,同时以降序排序显示 SALARY 列。
xxxxxxxxxx
select department_id,salary from employees order by department_id asc ,salary desc;
实时效果反馈
1.对SELECT 语句的执行顺序描述正确的是。
A SELECT 子句、FROM 子句、WHERE 子句、ORDER BY 子句
B ORDER BY 子句、FROM 子句、WHERE 子句、SELECT 子句
C WHERE 子句 、FROM 子句、SELECT 子句、ORDER BY 子句
D FROM 子句 、WHERE 子句、SELECT 子句、ORDER BY 子句
答案
1=>D