I\'m using PostgreSQL and am an SQL beginner. I\'m trying to create a table from a query, and if I run:
CREATE TABLE table_name AS (....query...) <
CREATE TABLE table_name AS (....query...)
Use do :
do $$ begin if not exists ( SELECT 1 FROM information_schema.tables WHERE table_schema = 'schema_name' AND table_name = 'bla ') then create table schema_name.bla as select * from blu; end if; end $$;