Skip to content

PostgreSQL Tutorial

  • How-To Guides
PostgreSQL Tutorial
Constraints

PostgreSQL- Exclusion Constraint

ByAdmin August 3, 2023August 3, 2023

An exclusion constraint is a type of constraint that allows you to specify a set of conditions that, if satisfied by any two rows in a table, will cause an error to be raised when trying to insert or update the table. Exclusion constraints are useful for preventing conflicts or overlaps between rows in a…

Read More PostgreSQL- Exclusion ConstraintContinue

Constraints

PostgreSQL- Foreign Key Constraint

ByAdmin July 14, 2023July 14, 2023

In PostgreSQL, a foreign key constraint is a type of constraint that is used to establish a relationship between two tables. The foreign key constraint ensures that the values in a column in one table correspond to the values in a column in another table. To create a foreign key constraint, you first need to…

Read More PostgreSQL- Foreign Key ConstraintContinue

Constraints

PostgreSQL – Primary Key Constraint

ByAdmin July 14, 2023July 14, 2023

In PostgreSQL, a primary key constraint is a way to enforce the uniqueness of a column or a group of columns in a table. A primary key constraint is created using the PRIMARY KEY keyword after the column or group of columns that you want to use as the primary key. For example, to create…

Read More PostgreSQL – Primary Key ConstraintContinue

Constraints

PostgreSQL – Not Null Constraint

ByAdmin July 14, 2023July 14, 2023

In PostgreSQL, the NOT NULL constraint is used to ensure that a column in a table does not contain any NULL values. If you attempt to insert a NULL value into a column with the NOT NULL constraint, PostgreSQL will raise an error and prevent the insertion. To apply the NOT NULL constraint to a…

Read More PostgreSQL – Not Null ConstraintContinue

Constraints

PostgreSQL – Check Constraint

ByAdmin June 7, 2023August 20, 2023

A check constraint is a type of constraint that allows you to define a condition that must be true for every row in a table. The check constraint can be used to enforce rules on columns, such as limiting the values that can be entered in a particular column or ensuring that certain columns are…

Read More PostgreSQL – Check ConstraintContinue

Constraints

PostgreSQL – Unique Constraint

ByAdmin June 1, 2023September 22, 2023

PostgreSQL supports unique constraints to ensure that the values in a particular column ( or set of columns ) are unique across all rows in a table. Unique constraint can be defined on one or more columns of a table. To create a unique constraint in PostgreSQL, you can use the UNIQUE keyword followed by…

Read More PostgreSQL – Unique ConstraintContinue

  • Querying Data
    • SELECT
    • WHERE
    • DISTINCT
    • DISTINCT ON
    • ORDER BY
    • GROUP BY
    • HAVING
    • LIMIT
    • OFFSET
    • INNER JOIN
    • LEFT JOIN
    • RIGHT JOIN
    • SELF JOIN
    • CROSS JOIN
    • NATURAL JOIN
    • FULL OUTER JOIN
    • UNION
    • UNION ALL
    • INTERSECT
    • IN
    • BETWEEN
    • LIKE
    • EXISTS
    • ANY
    • ALL
    • CUBE
    • ROLLUP
    • GROUPING SETS
  • CONSTRAINTS
    • Primary Key Constraint
    • Foreign Key Constraint
    • Check Constraint
    • Not Null Constraint
    • Unique Constraint
    • Exclusion Constraint
  • Conditional Expressions
    • CASE
    • COALESCE
    • LEAST
    • GREATEST
    • NULLIF
  • Comparison Operators
    • <=
    • >=
    • IS NULL
    • Not Equal (!=)
    • Equal(=)
    • Less Than (<)
    • Greater Than (>)
  • Logical Operators
    • AND
    • OR
    • NOT
  • Aggregate Functions
    • COUNT
    • SUM
    • MAX
    • MIN
    • AVG
    • STRING_AGG
    • ARRAY_AGG
  • String Functions
    • LENGTH
    • CONCAT
    • TRIM
    • LEFT
    • RIGHT
    • POSITION
    • SUBSTRING
    • REPLACE
    • TRANSLATE
    • SPLIT_PART
    • CHR
    • LPAD
    • FORMAT
    • MD5
    • ASCII
    • REGEXP_MATCHES
    • REGEX_REPLACE
  • Date Functions
    • NOW
    • CURRENT_DATE
    • CURRENT_TIME
    • CURRENT_TIMESTAMP
    • LOCALTIME
    • TO_DATE
    • TO_TIMESTAMP
    • DATE_TRUNC
    • DATE_PART
    • EXTRACT
    • AGE
  • Math Functions
    • ROUND
    • FLOOR
    • CEIL
    • TRUNC
    • ABS
    • MOD
  • Conversion Functions
    • TO_CHAR
    • TO_DATE
    • TO_NUMBER
    • TO_TIMESTAMP
  • Window Functions
    • ROW_NUMBER
    • RANK
    • DENSE_RANK
    • FIRST_VALUE
    • LAST_VALUE
    • LEAD
    • LAG
    • NTH_VALUE
    • NTILE
    • CUME_DIST
  • Data Manipulation
    • Insert
    • Update
    • Delete
    • Truncate
  • Data Types
    • DATA TYPES
    • INTEGER
    • BIGINT
    • NUMERIC
    • CHAR
    • VARCHAR
    • TEXT
    • DATE
    • TIME
    • TIMESTAMP
    • INTERVAL
    • BOOLEAN
    • ENUM
    • SERIAL
    • UUID
    • JSON
    • JSONB
    • Array
    • HSTORE
    • USER DEFINED
  • Database Objects
    • TABLES
    • VIEWS
    • INDEXES
    • SEQUENCES
    • MATERIALIZED VIEWS
    • FUNCTIONS
    • TRIGGERS
    • TYPES
  • Database Security
    • Roles
    • Privileges
    • GRANT
    • REVOKE
  • Table Management
    • Create Table
    • Rename Table
    • DROP TABLE
    • Add Column to a Table
    • Rename Column
    • Modify Datatype
    • DROP COLUMN
  • ARRAY FUNCTIONS
    • ARRAY_FILL
    • CARDINALITY
    • STRING_TO_ARRAY
    • ARRAY_TO_STRING
    • ARRAY_PREPEND
    • ARRAY_CAT
    • ARRAY_APPEND
    • ARRAY_REPLACE
    • ARRAY_REMOVE
    • ARRAY_POSITIONS
    • ARRAY_POSITION
    • ARRAY_LENGTH
    • UNNEST
  • JSON Functions
    • JSON_AGG
    • JSON_POPULATE_RECORDSET
    • JSON_EXTRACT_PATH_TEXT
    • JSON_POPULATE_RECORD
    • JSON_ARRAY_ELEMENTS
    • JSON_EACH
    • JSON_ARRAY_LENGTH
    • JSON_OBJECT
    • JSON_BUILD_OBJECT
    • JSON_BUILD_ARRAY
    • row_to_json
    • array_to_json
    • to_json
  • XML Functions
    • XMLCONCAT
    • XMLAGG
    • XMLELEMENT
    • XPATH
  • Transaction Control
    • COMMIT
    • ROLLBACK
    • SAVEPOINT
    • ROLLBACK PREPARED
  • Schema Management
    • Drop Schema
    • Change Schema Owner
    • Rename Schema
    • Create Schema
    • CURRENT_SCHEMA
  • PL/PgSQL
    • Programming in PostgreSQL Database
    • Variables
    • Constants
    • Row Type Variables
    • Functions
    • Procedures
    • Triggers
    • Cursors
    • IF Statement
    • CASE Statement
    • LOOP Statement
    • FOR LOOP
    • WHILE Statement

© 2025 PostgreSQL-Tutorial.com

  • How-To Guides