Skip to content
Dev.to

CA 40 – Alter Tables

This exercise was about ALTER TABLE. Instead of creating table again, we modify existing table like adding constraints, defaults, columns etc. Make email NOT NULL in customers table sql id="h4r9b2" ALTER TABLE customers ALTER COLUMN email SET NOT NULL; This makes sure future rows must have email. Make username unique in users table sql id="9zv1qx" ALTER TABLE users ADD CONSTRAINT unique_username UNIQUE (username); This prevents duplicate usernames. Add check constraint price > 0 in products tabl
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