Get access to the Postgres playground with one click
Welcome to the PostgreSQL Playground!
PostgreSQL 17 on Alpine — the world’s most advanced open-source RDBMS, with JSON support, window functions, CTEs, and 100+ powerful extensions.
Tip: Connect with
psql -U codeground -d codeground. Use \? in psql for help and \dt to list tables.What’s Pre-installed
- PostgreSQL 17 server + psql client
- Auto-provisioned database:
codeground - Credentials: user
codeground, passwordcodeground
Quick Start
psql -U codeground -d codeground \dt SELECT version();
Common Workflows
-- Create table with constraints
CREATE TABLE products (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL UNIQUE,
price NUMERIC(10,2) CHECK (price > 0),
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- Insert & query
INSERT INTO products (name, price) VALUES ('Widget', 9.99), ('Gadget', 24.99);
SELECT * FROM products ORDER BY price DESC;
-- Window function
SELECT name, price, RANK() OVER (ORDER BY price DESC) AS rank FROM products;Advanced Tips
-- JSONB column
CREATE TABLE events (id SERIAL, data JSONB);
INSERT INTO events (data) VALUES ('{"type":"click","user":42}');
SELECT data->>'type' FROM events WHERE (data->>'user')::int > 10;
CREATE INDEX events_data_idx ON events USING GIN (data);
-- CTE and recursive query
WITH RECURSIVE nums AS (
SELECT 1 AS n UNION ALL SELECT n+1 FROM nums WHERE n < 10
)
SELECT n FROM nums;
-- EXPLAIN ANALYZE
EXPLAIN ANALYZE SELECT * FROM products WHERE price > 10;Session Notes
- Session lasts 1 hour.
- PostgreSQL starts in background and is ready within seconds of your session opening.