MYSQL select投影语句

select 语句 投影

select 列名 from 表名;

select * from 表名 显示指定表所有列

select 表名

where 条件; 条件语句内可以是比较运算符或者逻辑运算符

运算符:

代数:+, -, *, \

比较:=, !=, >, <, >=, <=, !>, !<

逻辑:AND, BETWEEN, IN, LIKE, NOT, OR, IS NULL

删除表格:

drop table 表名;

逻辑运算符:

and 并且

select 列名1,列名2,列名n from 表名

where 条件1 and 条件2 and 条件n;

or 或者

select 列名1,列名2,列名n from 表名

where 条件1 or 条件2 or 条件n;

SQL中可以使用小括号()来控制运算优先级

between ...and... 在...之间

select 列名1,列名2,列名n from 表名

where 列名 between 第一个值 and 第二个值








猜你喜欢

转载自blog.csdn.net/qq_41802773/article/details/80370663