두 개 이상의 테이블을 결합하여 여러 행을 검색하는 것입니다.

 

SELECT * FROM weather JOIN cities ON (weather.city = cities.name);

실행 결과

 

JOIN TYPE

 

 

SELECT * FROM weather LEFT OUTER JOIN cities ON (weather.city = cities.name);

LEFT JOIN 실행 결과

SELECT CURRENT_USER, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP;

실행 결과

 

이번달의 첫번째 날과 마지막 날 구하기 입니다.

 

SELECT cast(date_trunc('month',current_date) as date) as firstday, (date_trunc('MONTH', current_date) + INTERVAL '1 MONTH - 1 day')::date lastday;

실행 결과

 

SELECT (last_name || '_' || first_name) AS full_name, last_name, first_name FROM employees

실행 예제

 

+ Recent posts