Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
CREATE TABLE test(id BIGINT PRIMARY KEY, code TEXT, name TEXT, amount NUMERIC); ALTER TABLE test ADD CONSTRAINT uq_test_code UNIQUE (code); ALTER TABLE test ADD CONSTRAINT chk_test_name CHECK (name IS NOT NULL); ALTER TABLE test ADD CONSTRAINT chk_test_amount CHECK (amount >= 0 AND amount <= 1000000); SELECT n.nspname || '.' || c.relname table_name, cn.conname constraint_name, pg_catalog.pg_get_constraintdef(cn.oid, TRUE) constraint_description FROM pg_catalog.pg_constraint cn INNER JOIN pg_catalog.pg_class c ON c.oid = cn.conrelid INNER JOIN pg_catalog.pg_namespace n ON n.oid = cn.connamespace WHERE n.nspname = 'public' AND c.relname = 'test';

Stuck with a problem? Got Error? Ask AI support!

Copy Clear