문법 순서
SELECT → FROM → WHERE → GROUP BY → HAVING → ORDER BY
실행 순서
FROM → WHERE → GROUP BY → HAVING → SELECT → ORDER BY
- AND | OR | NOT
- Combining : "( )"
- Declare Conditions : Column = 'value'
* when using "NOT", it has to be in front of Condition statement!!
- DESC, ASC : descending, ascending
* DESC, ASC must be at the end of "ORDER BY + column".
* DESC, ASC can be used in several Columns. (ORDER BY column ASC, column DESC)
- IS NULL, IS NOT NULL :
* IS NULL, IS NOT NULL comes after "WEHRE clause"
- AS : used to give a table, or a column in a table, a temporary name.
* [example] SELECT CustomerName AS Customer, ContactName AS [Contact Person]
It requires double quotation marks or square brackets if the alias name contains spaces:
* [example] SELECT CustomerName, Address + ', ' + PostalCode + ' ' + City + ', ' + Country AS Address
The following SQL statement creates an alias named "Address" that combine four columns (Address, PostalCode, City and Country):
'MySQL' 카테고리의 다른 글
[MySQL] 데이터 인덱스 최대값 구하기 : SELECT MAX(P_IDX) FROM S_PUSH (0) | 2021.02.26 |
---|---|
서브쿼리, JOIN (0) | 2021.02.16 |
Data요청 → 전달 → 수신 (0) | 2020.11.20 |
DATABASE2 MySQL - 10.INSERT(데이터 추가) (0) | 2020.11.19 |
DATABASE2 MySQL - 8.1.테이블의 생성(Column) (0) | 2020.11.19 |
댓글