postgresql logoPostgreSQL is one of the best database engines for an average web project and many who moves to psql from mysql (for example) often ask the following questions: what  is the analog of “show tables” in postgres? or how can I get the list of databases in postgres like “show databases” in mysql? The answers are short:

mysql: SHOW TABLES
postgresql: \d
postgresql: SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';

mysql: SHOW DATABASES
postgresql: \l
postgresql: SELECT datname FROM pg_database;

mysql: SHOW COLUMNS
postgresql: \d table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table';

mysql: DESCRIBE TABLE
postgresql: \d+ table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table';

 

29 Comments

 

  1. Pingback : PostgreSQL basic command | imron02

  2. May 22, 2013  4:18 am by nice Newport Beach massage therapy Reply

    I got this website from my pal who informed me on the topic of this website and now this time I
    am visiting this site and reading very informative articles or reviews
    here.

  3. May 27, 2013  3:52 pm by Best emac parts Reply

    Good day! Do you know if they make any plugins to protect against hackers?

    I'm kinda paranoid about losing everything I've worked hard
    on. Any tips?

  4. June 7, 2013  11:24 pm by Monica Reply

    all the time i used to read smaller content that also clear their motive, and that is
    also happening with this article which I am reading at this place.

Leave a reply

 

Your email address will not be published.