Day: March 13, 2022

Different Types of Constraints in PostgreSQL

Different Types of Constraints¶ Let us understand details about different types of constraints used in RDBMS databases. Supported constraints: NOT NULL constraint CHECK constraint UNIQUE constraint PRIMARY KEY constraint FOREIGN KEY constraint All constraints can be added while creating the table or on pre-created tables using ALTER. Typically we define NOT NULL, CHECK constraints while …

Different Types of Constraints in PostgreSQL Read More »

Overview of Data Types

Overview of Data Types¶ Let us get an overview of supported datatypes in Postgres. Here is the sample CREATE TABLE command for the review. CREATE TABLE users ( user_id SERIAL PRIMARY KEY, user_first_name VARCHAR(30) NOT NULL, user_last_name VARCHAR(30) NOT NULL, user_email_id VARCHAR(50) NOT NULL, user_email_validated BOOLEAN DEFAULT FALSE, user_password VARCHAR(200), user_role VARCHAR(1) NOT NULL DEFAULT …

Overview of Data Types Read More »

Creating Tables and Indexes in PostgreSQL

Creating Tables and Indexes¶ Let us go through the details related to creating tables and indexes. We will also talk about how columns, constraints etc while going through the details related to tables and indexes. DDL – Data Definition Language Overview of Data Types Adding or Modifying Columns Different Types of Constraints Managing Constraints Indexes …

Creating Tables and Indexes in PostgreSQL Read More »

Solution to Daily Product Revenue Problem in PostgreSQL

Solution – Daily Product Revenue¶ Let us review the Final Solution for our problem statement daily_product_revenue. Prepare tables Create tables Load the data into tables We need to project the fields which we are interested in. We need to have product_id as well as product_name as there can be products with same name and can …

Solution to Daily Product Revenue Problem in PostgreSQL Read More »