DaehunGwak / study-real-mysql-2

4 stars 0 forks source link

1. 11_쿼리 작성 및 최적화 (~11.4.9 select - order by) #5

Open DaehunGwak opened 2 years ago

DaehunGwak commented 2 years ago

진도

  1. 쿼리 작성 및 최적화 (11.4.9 ORDER BY 까지)

일시

2022.07.10.(일) 21:00

minkukjo commented 2 years ago

~ 11.4

SELECT

SELECT의 질의 순서

주의 사항

시간

Both the data types store data in “YYYY-MM-DD HH:MM:SS” format and include date as well as time. In spite of these similarities they are having the following differences −

Range − Datetime data type supports a date along with time in the range between 1000-01-01 00:00:00 and 9999-12-31 23:59:59. But timestamp data type supports a date along with time in the range between ‘1970-01-01 00:00:01’ to ‘2038-01-19 08:44:07’.
Size − Datetime requires 5 bytes along with 3 additional bytes for fractional seconds’ data storing. On the other hand, timestamp datatype requires 4 bytes along with 3 additional bytes for fractional seconds’ data storing. But before MySQL 5.6.4, DateTime requires 8 bytes along with 3 additional bytes for fractional seconds’ data storing.
Conversion from one timezone to other − Actually in MySQL5+, timestamp value converts from current time to UTC and vice-versa while datetime does not do any conversion.
Indexing − Indexing can be done on timestamp data but datetime data cannot be indexed.
Caching of query − queries having timestamp datatype can be cached but queries having datetime datatype cannot be cached.

Short Circuit Evaluation

Distinct

LIMIT

COUNT

JOIN

ORDER BY

DaehunGwak commented 2 years ago

notes

Edwin222 commented 2 years ago

앞부분

SELECT

where / group by / order by와 인덱스

minkukjo commented 2 years ago

https://www.tutorialspoint.com/What-is-the-difference-between-MySQL-DATETIME-and-TIMESTAMP-data-type 위에 제가 첨부한 글 원본입니당~