0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

SQL構文の記述する順番と実行される順番

Last updated at Posted at 2020-12-17

書き順

SELECT
FROM
JOIN
ON
WHERE
GROUPBY
HAVING
ORDERBY
LIMIT

実行の順序

FROM(どのテーブルかを選ぶ)
ON(テーブル同士がどのカラムで結合するかを選ぶ)
JOIN(結合するテーブルを選ぶ)
WHERE(選択する行を選ぶ)
GROUPBY(行ごとにまとめる。どの列でまとめるかを決める)
HAVING(GROUPBYでまとめたもののうち条件に合うものを抽出する)
SELECT(結果に出すカラムを選ぶ)
DISTINCT(重複をなくして結果を出す)
ORDERBY(順番を決める。どのカラムを昇順or降順にするか)
TOP(LIMIT)(上位何件を結果として出すか)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?