Insert 문

SQL

INSERT INTO table_name [ AS alias ] [ ( column_name [, ...] ) ]
    [ OVERRIDING { SYSTEM | USER } VALUE ]
    { DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }
    [ ON CONFLICT [ conflict_target ] conflict_action ]
    [ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]

SQL 사용 예시

# record를 입력할 table 생성 
CREATE TABLE employee(
	employ_no integer, 
	name text, 
	salary numeric);

## 단일 record 입력 
INSERT INTO employee VALUES (1, 'Thomas', 30000);

## 특정 col만 입력
INSERT INTO employee (employ_no, name) VALUES (2, 'Smith');

## 여러 record 입력
INSERT INTO employee (employ_no, name, salary) VALUES
	(3, 'Bread', 50000), 
	(4, 'Tim', 25000), 
	(5, 'Daniel', 100000);