Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Create Table With 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.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.