sql查询语句语法代码:
- select [选项] 列名 [from 表名] [where 条件] [group by 分组] [order by 排序][having 条件] [limit 限制]
复制代码- -- 可以直接输出内容
- mysql> select '锄禾日当午';
- +------------+
- | 锄禾日当午 |
- +------------+
- | 锄禾日当午 |
- +------------+
- 1 row in set (0.00 sec)
- -- 输出表达式
- mysql> select 10*10;
- +-------+
- | 10*10 |
- +-------+
- | 100 |
- +-------+
- 1 row in set (0.00 sec)
- mysql> select ch,math,ch+math from stu;
- +------+------+---------+
- | ch | math | ch+math |
- +------+------+---------+
- | 80 | NULL | NULL |
- | 77 | 76 | 153 |
- | 55 | 82 | 137 |
- | NULL | 74 | NULL |
- -- 表达式部分可以用函数
- mysql> select rand();
- +--------------------+
- | rand() |
- +--------------------+
- | 0.6669325378415478 |
- +--------------------+
- 1 row in set (0.00 sec)
复制代码
|
|