SELECT column1, column2, ...
FROM tablename
WHERE column LIKE pattern;
여러 개의 SQL문을 합쳐 하나의 SQL문으로 만들어주는 방법
컬럼의 개수가 같아야 한다
UNION
- 중복된 값을 제거하여 알려준다
SELECT column1, column2, ... FROM tableA
UNION
SELECT column1, column2, ... FROM tableB;
SELECT column1, column2, ... FROM tableA
UNION ALL
SELECT column1, column2, ... FROM tableB;
SELECT column1, column2, ...
FROM tableA ### 왼쪽
INNER JOIN tableB ### 오른쪽
ON tableA.column = tableB.column ### 공통된 것
WHERE condtion;
SELECT column1, column2, ...
FROM tableA ### 왼쪽
LEFT JOIN tableB ### 오른쪽
ON tableA.column = tableB.column ### 공통된 것
WHERE condtion;
SELECT column1, column2, ...
FROM tableA ### 왼쪽
RIGHT JOIN tableB ### 오른쪽
ON tableA.column = tableB.column ### 공통된 것
WHERE condtion;
SELECT column1, column2, ...
FROM tableA ### 왼쪽
LEFT JOIN tableB ### 오른쪽
ON tableA.column = tableB.column ### 공통된 것
WHERE condtion;
UNION
SELECT column1, column2, ...
FROM tableA ### 왼쪽
RIGHT JOIN tableB ### 오른쪽
ON tableA.column = tableB.column ### 공통된 것
WHERE condtion;
SELECT column1, column2, ...
FROM tableA, tableB
WHERE condition;
SELECT CONCAT(STRING1, STRING2...);
SELECT DISTINCT column1, column2 ...
SELECT column1, column2, ...
FROM tablename
WHERE column
LIMIT number