SQL超基础内容——3.稍微复杂一点的内容

DISTINCT

区分唯一性

SELECT distinct countrycode FROM world.city

LIMIT

SELECT distinct countrycode FROM world.city limit 10

IN

在where操作中某一列满足多个值

SELECT * FROM world.city WHERE countrycode in ('AIA','AGO','ARM')

BETWEEN

一般对数值变量操作

SELECT * FROM world.city WHERE countrycode in ('AIA','AGO','ARM') and (population between 50000 and 700000)

LIKE

一般对字符串操作

SELECT * FROM world.city WHERE Name like 'a%'

通配符

字符串可以用某些通用的形式来表达。

%
SELECT * FROM world.city WHERE Name like 'a%n'

你可能感兴趣的:(SQL超基础内容——3.稍微复杂一点的内容)