The Escuela

← From E-R diagram to MySQL: all 6 parts

Databases ยท Free practice

From E-R Diagram to MySQL, Part 4: Employees: NOT NULL, CHECK and a Foreign Key

Watch the lesson by Dr. J. Ubaldo Quevedo, then practice as many times as you want: every New button gives you a new example.

1. Watch

  • not null makes lname and fname required; default null lets address be missing.
  • check(age > 17 and age < 70) rejects rows outside the range.
  • foreign key (dname) references departments(dname): an employee's department must already exist.

2. Try it yourself

Practice as many times as you want. Every New button builds a new diagram, new constraints or new data. It's free, and you don't need an account or a MySQL installation.

Correct so far: 0