• 请查询出s_emp表中部门ID为50并且工资大于1500的员 工的信息:
SELECT * FROM s_emp WHERE salary>1500 and dept_id=50
WHERE条件查询-BETWEEN&IN
• 请查询出s_emp表中工资在1500到2000之间的员工信息:
SELECT * FROM s_emp WHERE salary between 1500 and 2000 • 请查询出s_dept表中region_id为1,3的部门信息:
SELECT * FROM s_emp WHERE dept_id=41 ORDER BY salary DESC
SQL> SELECTlast_name, dept_id, salary
2 FROM
s_emp
3 ORDER BYdept_id, salary DESC;
小结
Where条件查询 Between…and & In & Like 模糊查询 对查询结果排序
SELECT[DISTINCT] {*, column [alias], ...}
FROM
table
[WHERE
condition(s)]
[ORDER BY{column, expr, alias} [ASC|DESC]];
第三章 单行函数
本章目标
熟悉各种类型单行函数的使用 掌握转换函数的使用
两种SQL函数
• 请查询出当前用户下所有以‘s_’开头的表: SELECT table_name FROM user_tables WHERE table_name like 'S\_%' escape '\'