[Inflearn] DATABASE 1&2 - MySQL (Egoing Lee)
섹션 4를 듣고 정리하였다.
데이터를 가져오는 것
SELECT colunm1, column2, ... FROM table_name;
SELECT id,title,created,author FROM topic;
SELECT * FROM table_name;
SELECT * FROM topic;
SELECT colunm1, column2, ... FROM table_name WHERE condition;
SELECT id,title,created,author FROM topic WHERE author='egoing';
SELECT colunm1, column2, ... FROM table_name ORDER BY column expr;
SELECT id,title,created,author FROM topic WHERE author='egoing' ORDER BY id DESC;
DESC: descending order 내림차순
SELECT colunm1, column2, ... FROM table_name LIMIT row_count;
SELECT id,title,created,author FROM topic WHERE author='egoing' ORDER BY id DESC LIMIT 1;