/*
语法:
select 查询列表 from 表名;
*/
USE myemployees;
#1.查询表中的单个字段
SELECT last_name FROM employees;
#2.查询表中的多个字段
SELECT last_name,email FROM employees;
#3.查询所有字段
SELECT first_name
,last_name
,email
,phone_number
,job_id
,salary
,commission_pct
,manager_id
,department_id
,hiredate
FROM employees;
SELECT * FROM employees;
#4.起别名
SELECT 100%98 AS 结果;
SELECT last_name AS 姓,first_name AS 名 FROM employees;
SELECT salary AS ‘out put’ FROM employees;
#5.去重
SELECT DISTINCT department_id FROM employees;
#6.+号的作用
/*
select 100+90; 两个操作数都为数值型,则做加法运算
select ‘123’+90; 其中一方为字符型,试图将字符型数值转化为字符型
如果试图转化成功,则继续做加法运算
select ‘join’+90; 如果转化失败,则将字符型数值转换为0
select null+10; 只要其中一方为null,则结果为null
*/
SELECT CONCAT(last_name,first_name)AS 姓名
FROM employees;