mysql链表查询sql语句_MySQL查询SQL语句

1.基础查询

范围查询

在范围in

select 字段 from 表名 where 字段 in (值,值);

select id from stu where id in (2,3);

mysql链表查询sql语句_MySQL查询SQL语句_第1张图片

不在范围not in

select 字段 from 表名 where 字段 in (值,值);

select id from stu where id not in (2,3);

2b7365b9b139410d586c8435c40a74d9.png

在之间between

select 字段 from 表名 where 字段 between 值 and 值;

select id from stu where id between 1 and 3;

mysql链表查询sql语句_MySQL查询SQL语句_第2张图片

排序order by asc

select 字段 from 表名 order by 字段;(升序)

select * from stu order by id;

你可能感兴趣的:(mysql链表查询sql语句)