数据库中查询语句的完整格式是什么?再举个例子说明一下~

2024-12-28 18:26:26
推荐回答(3个)
回答1:

一个基本查询的逻辑过程:
(8) SELECT (9) DISTINCT (11)
(1) FROM
(3) JOIN
(2) ON
(4) WHERE
(5) GROUP BY
(6) WITH {CUBE | ROLLUP}
(7) HAVING
(10) ORDER BY --数字表示的是语句中部分的执行顺序。完全的结构语句如下列: SELECT DISTINCT top 5 * FROM table1
left JOIN table2 ON (table1.id=table2.id)
WHERE table1.id>10 GROUP BY table1.id HAVING table1.name like '张%'
ORDER BY name

回答2:

--这句是基本的,from后面是表明select * from table_name--where子句是说明查询条件where field =123--用and或者or来连接多个查询条件,like是模糊查询and field2 like '%234%'order by是用来排序的,还有group by是用来分组的,这个你得试试比较好order by field3

回答3:

select * from 表名查询表的全部