本章将介绍如何使用SELECT语句从表中检索一个或多个数据列。
USE myemployees;
SELECT last_name
FROM employees;
SELECT email,phone_number,manager_id
FROM employees;
SELECT *
FROM employees;
SELECT 101,'john',100%98,VERSION();
SELECT 100%98 AS 结果;
SELECT last_name AS 姓氏,first_name AS 名字
FROM employees;
SELECT last_name 姓氏,first_name 名字
FROM employees;
SELECT salary AS "out put"
FROM employees;
SELECT DISTINCT department_id
FROM employees;
SELECT 100+90;
SELECT '10'+90;
SELECT 'john'+90;
SELECT NULL+10;
SELECT CONCAT(last_name,' ',first_name) AS 姓名
FROM employees;
SELECT first_name
FROM employees
LIMIT 5;
SELECT first_name
FROM employees
LIMIT 3,4;
DESC departments;
SELECT * FROM departments;
SELECT DISTINCT job_id FROM employees;
SELECT CONCAT(`first_name`,',',`last_name`,',',`job_id`,',',IFNULL(commission_pct,0)) AS OUT_PUT
FROM employees;
|