Skip to content

PostgreSQL Tutorial

  • How-To Guides
PostgreSQL Tutorial
Math Functions

PostgreSQL – FLOOR Function

ByAdmin August 7, 2023August 7, 2023

In PostgreSQL, the FLOOR() function is used to round a numeric value down to the nearest integer that is less than or equal to the original value. The basic syntax of the FLOOR() function is as follows: FLOOR(numeric_expression) where numeric_expression is the numeric value or expression that you want to round down to the nearest…

Read More PostgreSQL – FLOOR FunctionContinue

Math Functions

PostgreSQL – CEIL Function

ByAdmin August 7, 2023August 20, 2023

In PostgreSQL, the CEIL() function is used to round a numeric value up to the nearest integer that is greater than or equal to the original value. It is also known as the “ceiling” function. The basic syntax of the CEIL() function is as follows: CEIL(numeric_expression) where numeric_expression is the numeric value or expression that…

Read More PostgreSQL – CEIL FunctionContinue

Math Functions

PostgreSQL – ABS Function

ByAdmin August 7, 2023August 7, 2023

In PostgreSQL, the ABS() function is used to compute the absolute value of a numeric or interval expression. The absolute value of a number is its magnitude without regard to its sign. If the number is positive or zero, the absolute value remains the same. If the number is negative, the absolute value is its…

Read More PostgreSQL – ABS FunctionContinue

Table Management

PostgreSQL – DROP COLUMN

ByAdmin August 6, 2023August 6, 2023

You can drop a column from a table in PostgreSQL using the ALTER TABLE statement with the DROP COLUMN clause. Dropping a column will permanently remove the column and all its data from the table. Always backup your data before performing this operation. The basic syntax to drop a column is as below: ALTER TABLE…

Read More PostgreSQL – DROP COLUMNContinue

Table Management

PostgreSQL – DROP TABLE

ByAdmin August 6, 2023August 6, 2023

In PostgreSQL, you can drop a table using the DROP TABLE statement. Dropping a table will permanently delete all the data and associated objects (such as indexes, triggers, and rules) related to that table. Make sure to take a backup of your data before executing the drop operation. The basic syntax to drop a table…

Read More PostgreSQL – DROP TABLEContinue

Table Management

PostgreSQL – Modify Datatype

ByAdmin August 6, 2023August 6, 2023

You can modify the datatype of a column in a table using the ALTER TABLE statement. However, changing the datatype of a column can lead to data loss or unexpected behavior if the new datatype cannot fully accommodate the existing data. Always, backup your data before making any changes. Below are the steps to modify…

Read More PostgreSQL – Modify DatatypeContinue

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

Page navigation

Previous PagePrevious 1 … 27 28 29 30 31 Next PageNext

  • 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