-
SQL SELECT 문법Back-End 2022. 1. 7. 21:47
공식문서의 SELECT문 사양
SELECT [ALL | DISTINCT | DISTINCTROW ] [HIGH_PRIORITY] [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT] [SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS] select_expr [, select_expr] ... [into_option] [FROM table_references [PARTITION partition_list]] [WHERE where_condition] [GROUP BY {col_name | expr | position}, ... [WITH ROLLUP]] [HAVING where_condition] [WINDOW window_name AS (window_spec) [, window_name AS (window_spec)] ...] [ORDER BY {col_name | expr | position} [ASC | DESC], ... [WITH ROLLUP]] [LIMIT {[offset,] row_count | row_count OFFSET offset}] [into_option] [FOR {UPDATE | SHARE} [OF tbl_name [, tbl_name] ...] [NOWAIT | SKIP LOCKED] | LOCK IN SHARE MODE] [into_option] into_option: { INTO OUTFILE 'file_name' [CHARACTER SET charset_name] export_options | INTO DUMPFILE 'file_name' | INTO var_name [, var_name] ... }
데어터 조작어 - 검색
SELECT [ALL|DISTINCT] 속성이름(들) = '*'은 모든 열을 나타내고, DISTINCT는 중복을 제거 FROM 테이블이름(들) [WHERE 조건(들)] [GROUP BY 속성이름] [HAVING 검색조건(들)] [ORDER BY 속성이름 [ASC|DESC]] = ASC는 오름차순, DESC는 내림차순
자주 쓰이는 명령어 처리 순서
FROM - ON - JOIN - WHERE - GROUP BY - WITH CUBE/ROLLER - HAVING - SELECT - DISTINCT - ORDER BY - TOP
출처: https://lamarr.dev/sql/2020/04/30/01-sqlselect.html
출처: https://psun.tistory.com/entry/SQL-%EB%AC%B8%EB%B2%95-%EC%A0%95%EB%A6%AC
'Back-End' 카테고리의 다른 글
CI/CD (0) 2022.02.22 SQL Select Query 문법 처리 순서 (0) 2022.02.22 MongoDB 장점 (0) 2022.02.17 REST API (0) 2022.02.15 HTTPS와 SSL (0) 2022.01.29