The Escuela

← MySQL Stored Functions: all 3 parts

Databases ยท Free practice

MySQL Stored Functions, Part 3: A View That Uses the Function

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

1. Watch

  • A view is a saved SELECT that you query like a table: select * from student_total_courses;
  • The function runs once per row: total_no_courses(s.snum) as courses.
  • Correction: joining enrolled and student gives one row per enrollment, so students repeat and students with no courses are missing. Use from student s to list each student once.

2. Try it yourself

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

Correct so far: 0