Run the below query to view all the databases in Postgres. select oid as db_id, datname as db_name, datallowconn from
Continue readingCategory: Postgresql
PostgreSQL – Add not-null Constraint
Below is the syntax to add the not null constraint to a table column in postgres database ALTER TABLE table_name
Continue readingPostgreSQL – Generate Explain Plan
You can view the explain plan of any query by prefixing the query with EXPLAIN keyword as shown below: EXPLAIN
Continue readingPostgreSQL – Create Table
A Table is a database object that holds data. You must specify table name, column names and their data types
Continue readingPostgreSQL – Create View
A view is a named query stored in the database. A view does not store any data like a table
Continue readingPostgreSQL – Drop Trigger
Syntax to drop trigger in Postgres database: DROP TRIGGER triggername ON tablename;
Continue readingPostgreSQL – Rename Table
Below is the syntax to rename a table in Postgres where tablename is the current name of the table and
Continue readingPostgreSQL – Rename Constraint
Below is the syntax to rename a constraint in Postgres database where table_name is the name of the table and
Continue readingPostgreSQL – Drop Tablespace
Syntax to drop a tablespace in Postgres: DROP TABLESPACE tablespace_name;
Continue readingPostgreSQL – Drop Type
You can remove a user defined data type using below syntax: DROP TYPE typename;
Continue reading