300x250 DataBase23 Database / PostgreSQL 이번달의 첫번째 날과 마지막 날 구하기. 이번달의 첫번째 날과 마지막 날 구하기 입니다. SELECT cast(date_trunc('month',current_date) as date) as firstday, (date_trunc('MONTH', current_date) + INTERVAL '1 MONTH - 1 day')::date lastday; 2019. 7. 14. Database / PostgreSQL 문자열 결합하기. SELECT (last_name || '_' || first_name) AS full_name, last_name, first_name FROM employees 2019. 7. 14. Database / PostgreSQL COALESCE 사용하기(오라클 NVL) COALESCE(A, B); A값이 NULL일 경우 B로 반환합니다. select category_id, description, COALESCE(description, 'empty') as COALESCE_RESULT from categories; 2019. 7. 14. Database / PostgreSQL UNION 사용하기 두 개 이상의 쿼리를 한번에 출력할 때 사용합니다. 출력할 때의 컬럼의 개수가 같아야 합니다. 예를 들어 첫번째 쿼리의 출력되는 컬럼은 2개인데 두번째 쿼리의 출력되는 컬럼은 1개라면 오류 발생합니다. SELECT company_name FROM customers UNION SELECT address FROM suppliers; 2019. 7. 14. 이전 1 2 3 4 5 6 다음 300x250