Create Table With Constraints
Easy
DDL & Constraints
Write a CREATE TABLE statement for Students with: id as primary key; email unique and not null; age that must be at least 18; and status that defaults to 'active'.
Table schema
Students(id, email, age, status)Sample data
Valid: INSERT (1, 'a@x.com', 20)
Invalid: INSERT (2, 'a@x.com', 22) -- duplicate email
Invalid: INSERT (3, 'b@x.com', 15) -- age below 18
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.