Last active
July 19, 2021 08:10
-
-
Save andrewp-as-is/d1154ec6601933aebcdcf6d259b85831 to your computer and use it in GitHub Desktop.
postgres copy table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE IF NOT EXISTS t( | |
id serial PRIMARY KEY, | |
value text | |
); | |
INSERT INTO t(id,value) VALUES (1,'value1'), (2,'value2'); | |
CREATE TABLE t_with_data AS TABLE t; | |
CREATE TABLE t_without_data AS TABLE t WITH NO DATA; | |
select COUNT(*) from t_without_data; | |
select COUNT(*) from t_with_data; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment