1. MySQL
기본 문법(JOIN 전까지)
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
null
이 입력 됨INSERT INTO table_name
VALUES (value1, value2, value3, ...);
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
WHERE
를 쓰지 않으면 해당 테이블의 전체 값이 변경 됨
UPDATE Customers
SET PostalCode = 00000
WHERE Country = 'Mexico';
DELETE FROM table_name WHERE condition;
DELETE FROM table_name;
SELECT column1, column2, ...
FROM table_name
WHERE columnN LIKE pattern;
NOT LIKE
WHERE CustomerName NOT LIKE 'a%'
LIKE
연산자와 같이 쓰임SELECT * FROM Customers
WHERE CustomerName LIKE '_r%'
WHERE CustomerName LIKE 'a_%_%'
WHERE
에서 여러 값을 선택할 때SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1, value2, ...);
SELECT * FROM Customers
WHERE Country IN (SELECT Country FROM Suppliers);
NOT IN
SELECT * FROM Customers
WHERE Country NOT IN ('Germany', 'France', 'UK');
SELECT LEFT(Country,1), COUNT(*)
FROM Customers
group by LEFT(Country,1)
MySQL_w3schools
MySQL_w3schools 연습
SQL문법 정리_내 블로그
SQL 문자열 자르기