MySQL语句语法回顾

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
查询当前数据库服务器所有的数据库
show databases;
选中某个数据库
use 数据库名字 test
查询当前数据库所有的表
show tables;
查询t1表所有数据
查询关键字 select
* 所有
from 表名
select * from t1;
条件查询 id=2
where 条件 编程 if(条件 true){执行}
select * from t1 where id=2;
查询id=2 pass =111
union 合并查询
2个特性:
前面查询的语句和后面的查询语句结果互不干扰
前面的查询语句的字段数量和后面的查询语句字段数量要一致

* == 3
select id from t1 where id=-1 union select * from t1 where pass =111;

order by 排序
order by 字段名字 id 也可以 跟上数字 1 2 3 4 .。。。。。

猜解表的列数 知道表有几列