Skip to content

PostgreSQL Tutorial

  • How-To Guides
PostgreSQL Tutorial
JSON Functions

PostgreSQL – row_to_json Function

ByAdmin August 23, 2023August 23, 2023

The row_to_json function in PostgreSQL is used to convert a row of a table or a composite type (user-defined type) into its corresponding JSON representation. This function is particularly useful when you want to retrieve data from a table and represent it in JSON format. The basic syntax of the row_to_json function is as follows:…

Read More PostgreSQL – row_to_json FunctionContinue

JSON Functions

PostgreSQL – array_to_json Function

ByAdmin August 23, 2023August 23, 2023

The array_to_json function in PostgreSQL is a powerful tool that allows you to convert an array of values into its corresponding JSON representation. This function is part of PostgreSQL’s rich set of functions for working with JSON data, providing a seamless way to transform arrays into a format that’s compatible with JSON. Basic Syntax The…

Read More PostgreSQL – array_to_json FunctionContinue

JSON Functions

PostgreSQL – to_json Function

ByAdmin August 23, 2023August 23, 2023

The to_json function in PostgreSQL is used to convert a PostgreSQL row or value into its corresponding JSON representation. This function is often used when you want to convert data from a table or a single value into JSON format. Here are some common use cases for the to_json function: Convert a Row to JSON:…

Read More PostgreSQL – to_json FunctionContinue

Page navigation

Previous PagePrevious 1 2

  • 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