Mysql进阶一 - 基础查询
#1.查询单个字段
SELECT
last_name
FROM
employees ;
#2.查询多个字段
SELECT first_name,salary,email FROM employees;
#3.查询表中所有字段(双击/0
#方式一
SELECT `first_name`,
`last_name`,
`email`,
`phone_number`,
`job_id`,
`salary`,
`commission_pct`,
`department_id`,
`hiredate`
FROM employees;
#方式二
SELECT * FROM employees;
#4.查询常量值
SELECT 100;
SELECT 'john';
#5.查询表达式
SELECT 100/98
#6.查询函数
SELECT VERSION ();
#7./起别名
#*便于理解,如果要查询的字段重名可以使用别名区别
#方式一
SELECT 100*98 AS 结果;
SELECT last_name AS 姓,first_name AS 名 FROM employees;
#方式二
SELECT last_name 姓,first_name 名 FROM employees;
#案例 查询salary,显示结果为 output (若是特殊符号则用双引号)
SELECT salary AS "out put" FROM employees;