Select 查询
查询表中的所有数据:SELECT * FROM 表名;
查询表中的A1,A2列的数据:SELECT A1,A2 FROM 表名;
where 条件语句
查询表中A1大于1的所有数据:SELECT * FROM 表名 WHERE A1>1;
查询表中A1大于1且A2大于1的所有数据:SELECT * FROM 表名 WHERE A1>1 AND A2>1;
子查询语句
id的结果从另一个语句中获取:SELECT * FROM A WHERE Id in (SELECT consignmentid FROM B);
ORDER BY 排序(desc降序 asc升序)
order by语句放在所有关键字以后,如条件语句(where),分组语句(group by)
根据字段CreationTime 升序:SELECT * FROM testconsignment ORDER BY CreationTime ASC;
根据字段CreationTime 升序:SELECT * FROM testconsignment ORDER BY CreationTime DESC;
语句放在分组和条件语句之后:SELECT count(*),LoginAccountName FROM driver GR