← MySQL Stored Functions: all 3 parts
Databases ยท Free practice
MySQL Stored Functions, Part 2: A Stored 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 stored function takes parameters and returns one value, so you can use it inside a SELECT.
RETURNS INTEGERin the header declares the type;RETURN total;sends the value back.select count(*) into total from enrolled e where e.snum = sid;stores the count in a local variable.
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