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 screen_types ( id serial primary key, name text ); insert into screen_types (name) values ('regular'), ('stereo'); create table halls ( id serial primary key, name text, seets_count int, screen_type int references screen_types(id) ); insert into halls (name, seets_count, screen_type) values ('Blue', 25, 'regular'); -- ALTER TABLE table_name DROP CONSTRAINT IF EXISTS ( SELECT constraint_name FROM information_schema.constraint_column_usage WHERE table_name='halls' AND column_name='screen_type'); alter table halls drop constraint halls_screen_type_check ; alter table halls add constraint halls_screen_type_check check (screen_type in ('regular', 'stereo', '3d')); insert into halls (name, seets_count, screen_type) values ('Gold', 15, '3d'); select * from halls;

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

Copy Clear