PostgreSQL에 데이터를 넣기 위해서 INSERT INTO ... VALUES 구문 활용
first_name, last_name, email, company, street, city, state, zip, phone, birth_date, sex, date_entered, id(PRIMARY KEY, SERIAL)
/* INSERT INTO 테이블명(
컬럼1명,
컬럼2명,
...
)
VALUES (
컬럼1에 집어넣을값,
컬럼2에 집어넣을값,
...
)
*/
INSERT INTO customer(
first_name, last_name, email,
company, street, city,
state, zip, phone, birth_date,
sex, date_entered
)
VALUES (
'Christopher', 'Jones', 'christopherjones@bp.com', 'BP',
'347 Cedar St', 'Lawrenceville', 'GA', '30044',
'348-848-8291', '1938-09-11', 'M', current_timestamp
);
SELECT *
FROM customer;

id SERIAL PRIMARY KEY
SERIAL은 내부적으로 자동으로 숫자를 증가시키기 때문에,
INSERT 할 때 직접 넣지 않아도 PostgreSQL이 알아서 번호를 부여한다.
SELECT first_name, last_name, email, id
FROM customer;
-- 첫 번째로 집어넣은 값에 1 부여
-- 추후에 INSERT로 값을 집어넣으면 2 부여

current_timestamp는 쿼리가 실행된 현재 날짜와 시간을 의미한다.

쿼리를 실행한 2026년 1월 23일 22시 13분 51초가 저장되어있다.