当前位置:网站首页>SQL query statement

SQL query statement

2022-06-26 06:57:00 My talented girlfriend

The basic query

  1. Specified field
select  Field A, Field B from  surface 
  1. Query all fields
select * from  surface 

Query data filtering

  1. Simple filtering
Operator Example
=id = 1
!= or <>sex != 1
>= 、> 、<、<=salary > 1000
BETERRNsalary between 100 and 200
INname IN(‘ Cherish ’,‘ Barbarian ’)
  1. A null value judgment
select * from user where name is null
  1. Text blur
    Use like matching ,% matching 0 Or more than one character ,_ Match a character
select * from user where name like '%i'
  1. Combinatorial logic
    AND OR NOT
  2. duplicate removal
    DISTINCT

Sort

order by –

ASC: Ascending ( Default )
DESC: Descending

Qualified result set

Here is mysql How to write a sentence ,limit Specify the quantity ,offset Specify where to start , That's the offset , The default is 0 Start

select  Field  from  Table name  order by  Field  limit a offset b

notes

  • – Two hyphens
  • /* */ Used for multi line comments
原网站

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