Assignment 4 - Stored Functions
Objectives
To write a stored function that can be used in Queries and Stored Procedures
Assignment
You will be writing 2 stored functions for this assignment. One functions will be a table valued function (they will return a set of values), the other will be a Scalar function.
Function 1: func_GetArtistIDsForSong - For this function you will pass the title of the song to the function. The function will find all Artists that have songs that match the pattern of the song title. For example if you call func_GetArtistIDsForSong('S') the function will return a table of integer ids corresponding to every artist that has a song beginning with S. You will need to use the LIKE operator in the query to do this.
Function 2: func_GetArtistNameForArtistID - This will operate as expected in the title. You will pass an ArtistID to the function and it will return the Artist Name.
With these 2 functions you will demonstrate that you can create a single SQL Query that uses the function call to return the artist names for all songs that begin with a specific letter. Demonstrate this with a real query.
You will turn in the text of the 2 functions (as a text file) and a screen capture of your query with results (doc or pdf format).
Information
Estimated Completion Time
Allot a few hours for this (it took me about 15 minutes to complete)
Supporting Lectures
Week 4 lectures and reference COP4709 Course Lectures By Week
Questions and Answers
External Resources
Grading Criteria
Comments (0)
You don't have permission to comment on this page.