Please write a stored function named which will take two inputs (type, keyword). The keyword is a substring used to search the course name. You must use LIKE for the pattern match.
Please write a stored function named which will take two inputs (type, keyword).
The keyword is a substring used to search the course name. You must use LIKE for the pattern match.
If the type is not 1 or 2, return an error message “Please input a valid type.”
If the keyword is empty or null, return an error message “Please input a valid keyword.”
If there is no course name contains the keyword, return “No course found that contains keyword: zzz.” where zzz
is the input keyword.
If type is 1, return all course ID: course name that course name contains the keyword. If type is 2, return all course ID: student ID who took the courses that course name contains the keyword.
The return should be in one line and your report format must match the test cases.
You need to use group_concat() function to merge multiple rows output into one line.
Step by step
Solved in 5 steps with 2 images