1、下面的语句是否可以执行成功
SELECT last_name , job_id , salary AS sal
FROM employees;
2、下面的语句是否可以执行成功
SELECT * FROM employees;
3、找出下面语句中的错误
SELECT employee_id , last_name,
salary * 12 "ANNUAL SALARY"
FROM employees;
4、显示表departments的结构,并查询其中的全部数据 desc 表名;
显示结构
DESC departments;
SELECT * FROM departments;
5、显示出表employees中的全部job_id(不能重复)distinct
SELECT DISTINCT job_id FROM employees;
6、显示出表employees的全部列,各个列之间用逗号连接,列头显示OUT_PUT
SELECT CONCAT(last_name,',',first_name,',',email) out_put FROM employees;
/*
+的功能:做运算
特点:
(1)如果一方为字符型,则试图将字符型转换为数值型
如果转换成功,则继续运算,如果转换失败,则显示为0
(2)如果一方为null,则结果肯定为null
(3)如果两方都为数值型,则直接运算
select 10+19; #29
select '123'+100; #223
select 'john'+89; #89
select null+'1234';
*/
7、显示出表employees部门编号在80-100之间 的姓名、职位
SELECT last_name,job_id,department_id FROM employees
WHERE department_id>=80 AND department_id<=100;
8、显示出表employees的manager_id 是 100,101,110 的员工姓名、职位
SELECT last_name,job_id
FROM employees
WHERE manager_id=100 OR manager_id=101 OR manager_id = 110;