Embed this tool on your site
<iframe src="https://devtoolbox.dedyn.io/tools/postgresql-query-builder" width="100%" height="700" frameborder="0" title="PostgreSQL Query Builder"></iframe>

PostgreSQL Query Builder

Visually build PostgreSQL queries with ILIKE, jsonb, RETURNING, ON CONFLICT upsert, and CREATE TABLE support.

Table

Columns

Joins

Where Conditions

Group By / Having

Order By

Limit / Offset

Generated PostgreSQL

Frequently Asked Questions

How do I build an upsert query with ON CONFLICT in PostgreSQL?
Select the INSERT query type, add your column-value pairs, then enable the ON CONFLICT toggle. Specify the conflict column (usually a unique or primary key column), and add the columns to update when a conflict occurs. The tool generates a complete INSERT ... ON CONFLICT (column) DO UPDATE SET statement, which is PostgreSQL's upsert syntax.
What PostgreSQL-specific features does this query builder support?
This tool supports PostgreSQL-specific features including ILIKE for case-insensitive pattern matching, jsonb column types and operators, the RETURNING clause for INSERT/UPDATE/DELETE statements, ON CONFLICT for upsert operations, PostgreSQL data types like SERIAL, UUID, JSONB, TIMESTAMPTZ, and array types, as well as CREATE TABLE with constraints like REFERENCES for foreign keys.
How do I use the RETURNING clause in PostgreSQL queries?
The RETURNING clause is available for INSERT, UPDATE, and DELETE queries. Simply type the columns you want returned (e.g., "id, name" or "*") in the RETURNING input field. PostgreSQL will return the specified columns from the affected rows, which is useful for getting auto-generated IDs or confirming what was changed without a separate SELECT query.
Can I build CREATE TABLE statements with this tool?
Yes. Select the CREATE TABLE query type, enter a table name, then add columns with their PostgreSQL data types (INTEGER, VARCHAR, TEXT, BOOLEAN, TIMESTAMP, SERIAL, BIGSERIAL, UUID, JSONB, and more). For each column you can set constraints including PRIMARY KEY, NOT NULL, UNIQUE, DEFAULT values, and REFERENCES for foreign key relationships.
How do I build a SELECT query with JOINs and WHERE conditions?
Select the SELECT query type, enter your main table, then use "Add Join" to add INNER, LEFT, RIGHT, FULL, or CROSS joins with ON conditions. Use "Add Condition" to build WHERE clauses with operators like =, !=, LIKE, ILIKE, IN, BETWEEN, IS NULL, and more. Conditions can be combined with AND/OR. Add GROUP BY, HAVING, ORDER BY, LIMIT, and OFFSET as needed.

Related Content

SQL Query Builder SQL Formatter SQL Playground PostgreSQL Complete Guide
Keyboard Shortcuts
Ctrl+Enter Copy SQL
Ctrl+L Clear / Reset