Postgres cheat sheet




    Create table = CREATE TABLE name_of_table (column1 data type, column2 data type);

    When the code is executed, the database "name_of_database" and the table "name_of_table" are created.

    list databases = \l;
    list tables = \dt;
    Create database = CREATE DATABASE name_of_database;
    Get size of db = SELECT pg_size_pretty( pg_database_size('dbname') );
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.