Skip to content
Dev.to

Alter Queries

In this assignment, I worked on modifying existing tables using ALTER TABLE. This helped me understand how to update constraints without recreating tables. 1.Make email NOT NULL in customers ALTER TABLE customers ALTER COLUMN email SET NOT NULL; 2.Make username UNIQUE in users ALTER TABLE users ADD CONSTRAINT unique_username UNIQUE (username); 3.Add CHECK constraint on price > 0 in products ALTER TABLE products ADD CONSTRAINT price_check CHECK (price > 0); 4.Set default 'pending' for status in o
Read original on dev.to
0
0

Comment

Sign in to join the discussion.

Loading comments…

Related

Liked this? Start your own feed.

Your own feed is waiting.
0
0