The Escuela

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

Databases · Free practice

From E-R Diagram to MySQL, Part 6: Inserting Rows, and Where Triggers Come In

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

  • insert into departments values('Systems','Denton','Texas'); then select * from departments; to check it.
  • “A driver must work in a department located in Texas and be 25 or older” needs data from employees and departments, so a CHECK on drivers can't enforce it.
  • A BEFORE INSERT trigger on drivers can look it up and stop the insert with SIGNAL.

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