Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using the Script for provided with this assignment do the following. Create a function called fn_GetUserName which will return the user name from the TUsers
Using the Script for provided with this assignment do the following.
- Create a function called fn_GetUserName which will return the user name from the TUsers table.
- Create a function called fn_GetSongs which will return the song title and artist from the TSongs table.
- Write a Select statement, using the functions, that will pull the user ID, the user name, the song ID and the song and artist from TUserFavoriteSongs table.
- Create a view from this select statement
- Write a Select statement to pull all records from the view (you may use * here)
Problem 2:
Using the Script for provided with this assignment do the following.
- Create a function called fn_GetCourse which will return the course name and description from the TCourses table.
- Create a function called fn_GetStudents which will return the last name, first name from the TStudents table. Name should be in format of LastName, FirstName.
- Create a function called fn_GetBook which will return the book name and author from the TBooks table.
- Create a function called fn_GetInstructor which will return the last name, first name from the TInstructors table. Name should be in format of LastName, FirstName.
- Write a Select statement, using the functions, that will pull the student ID, the student name, the course ID, name and description from TCourseStudents table.
- Write a Select statement, using the functions, that will pull the book ID, name, author, the course ID, name and description from TCourseBooks table.
- Write a Select statement, using the functions, that will pull the instructor ID, name, the course ID, name and description from TCourses table.
- Create a separate view for each of the select statements in steps 5, 6 & 7
- Write a Select statement to pull all records from the views (you may use * here)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started