PostgreSQL: Create table if not exists AS

后端 未结 6 1317
不思量自难忘°
不思量自难忘° 2020-12-29 04:54

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...)
<         


        
6条回答
  •  滥情空心
    2020-12-29 05:16

    It’s simple:

     CREATE TABLE IF NOT EXISTS abc ( sql_id BIGINT(20) NOT NULL
       AUTO_INCREMENT PRIMARY KEY, sender VARCHAR(20) NULL)
    

提交回复
热议问题