3.2.5 SELECT

3.2.5.1 Syntax

SELECT

[ALL | DISTINCT | DISTINCTROW ]

select_expr

[, select_expr ...]

[FROM table_references [WHERE where_condition]

[GROUP BY {col_name | expr | position} [ASC | DESC], ...]

[HAVING where_condition] [ORDER BY {col_name | expr | position} [ASC | DESC], ...]

[LIMIT {[offset,] row_count | row_count OFFSET offset}]

3.2.5.2 举例

select id,col1,col3 from test where id=3;
select distinct col1,col3 from test where id>=3;
select count(*),max(id),col1 from test group by col1 desc having(count(*)>1) order by col1 desc;
select id,col1,col3 from test order by id limit 2 offset 2;
select id,col1,col3 from test order by id limit 2,2;
select 1+1,'test',id,col1*1.1,now() from test limit 3;
select current_date,current_timestamp;

results matching ""

    No results matching ""