How to generate the create table sql statement for an existing table in postgreSQL

0 votes
How do I get the create table SQL statement for an existing table in Postgres via commandline or SQL statement?
Jun 19 in Others by polo
• 1,500 points
9 views

1 answer to this question.

0 votes

Create a table for a demo:

CREATE TABLE your_table(
    thekey   integer NOT NULL,  
    ticker   character varying(10) NOT NULL,
    date_val date,
    open_val numeric(10,4) NOT NULL
); 

pg_dump manual, can output the table create psql statement:

pg_dump -U your_user your_database -t your_table --schema-only

Which prints:

-- pre-requisite database and table configuration omitted
CREATE TABLE your_table (
    thekey integer NOT NULL, 
    ticker character varying(10) NOT NULL, 
    date_val date,  
    open_val numeric(10,4) NOT NULL 
); 
-- post-requisite database and table configuration omitted
  
answered Jun 20 by nisha
• 2,160 points

Related Questions In Others

0 votes
1 answer

How to create an Icon Button in Flutter?

Hi@akhtar, To create an Icon Button in Flutter, ...READ MORE

answered Jul 24, 2020 in Others by MD
• 95,360 points
331 views
0 votes
1 answer

How to create an input field in Flutter?

Hi@akhtar, There are different ways to create an ...READ MORE

answered Aug 9, 2020 in Others by MD
• 95,360 points
268 views
0 votes
1 answer

How to create an Alert Button in Flutter?

Hi@akhtar, You can do this with the help ...READ MORE

answered Sep 3, 2020 in Others by MD
• 95,360 points
226 views
0 votes
1 answer
0 votes
1 answer
0 votes
2 answers

How to get the URL of the current tab in Google Chrome?

Its so simple.... If you want to ...READ MORE

answered Aug 12, 2020 in Others by Steve
• 200 points
715 views
0 votes
1 answer

Where is the documentation to refer for coinbase api integration of Etherium coin currency in php?

Hey there! Please refer to the following ...READ MORE

answered Jan 25, 2019 in Others by Omkar
• 69,210 points
268 views
0 votes
1 answer

How can you create an object in JavaScript?

JavaScript supports Object concept very well. You can create ...READ MORE

answered Mar 7, 2019 in Others by Frankie
• 9,830 points
182 views
0 votes
1 answer

How to prepare an APK for the Amazon Android App Store

you should use zipalign during every build, ...READ MORE

answered Jun 1 in Others by nisha
• 2,160 points
22 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP