Hard sql

PostgreSQL SERIAL and REFERENCES #37

Problem

PostgreSQL: PostgreSQL SERIAL and REFERENCES #37

Hints
  • Use WITH for CTEs, OVER() for windows

Your solution

TestStatusDetails
Ready — edit the code above and click Run or Submit.

Solution

CREATE TABLE orders (
  id SERIAL PRIMARY KEY,
  customer_id INT NOT NULL REFERENCES customers(id),
  amount NUMERIC(12,2) NOT NULL CHECK (amount >= 0),
  created_at TIMESTAMPTZ DEFAULT NOW()
);

Try solving on your own first, then reveal the official answer.

Explanation

PostgreSQL: CTEs, window functions, ILIKE, JSONB @>, EXPLAIN ANALYZE.

Discussion

0

Sign in to join the discussion.

No discussions yet — ask the first question!

Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details