当前位置:网站首页>Basic query

Basic query

2022-06-26 04:37:00 Lili demon_


grammar :select Query list from Table name ;
Query list : Field 、 Constant values 、 expression 、 function

1. A single field in a query table

select last_name from employees;

2. Multiple fields in the query table

select last_name,salary,email from employees;

3. Query all fields in the table

select * from employees;

4. Query constant value 、 expression 、 function

SELECT 100;
SELECT 20%6  result ;
SELECT VERSION();

5. names

SELECT 20%6 AS  result ;
SELECT 20%6  result ;

6. duplicate removal

SELECT DISTINCT employee_id FROM employees;

7. Join fields

SELECT CONCAT(last_name,first_name) AS  full name  FROM employees;

8. IFNULL

SELECT IFNULL(commission_pct,0) AS  Bonus  FROM employees;
#  Selection field , If the value in the field is  NULL  Output custom content 
原网站

版权声明
本文为[Lili demon_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260428040589.html