Answered step by step
Verified Expert Solution
Question
1 Approved Answer
DONT use chegg or chatgpt!!!! AND Dont copy from chegg cuz its wrongBuild a music recommendation service. You are given a template database with genres,
DONT use chegg or chatgpt!!!! AND Dont copy from chegg cuz its wrongBuild a music recommendation service.
You are given a template database with genres, regions, and bands. See attached file.
Tasks:
points Create db user called "api" with limited access of read only of initially given tables in the template, and
readwriteupdate permissions for all additional tables created for this project in the next steps.
points Create a "User" relation. User needs an ID name, and home country.
points Create a "Favorites" relation. Favorites needs to reference user, and bands.
points Create a query to determine which subgenres come from which regions.
points Create a query to determine what other bands, not currently in their favorites, are of the same subgenres as those
which are.
points Create a query to determine what other bands, not currently in their favorites, are of the same genres as those which
are.
points Create a query which finds other users who have the same band in their favorites, and list their other favorite bands.
points Create a query to list other countries, excluding the user's home country, where they could travel to where they could
hear the same genres as the bands in their favorites.
points Add appropriate indexing to all tables and optimize all queries.
points Write an application in the back end language of your choice BE languages only, no JS or Node to access the
database using the created user in task # with a function to run each query in tasks with the user ID passed as a
parameter where needed.
points Create functions, each to insert users and insert & delete favorites. Insert at least users and favorites for each
user. You may use static data in the program to call these functions programmatically so long as SQL calls are still properly
parameterized. Note that a user may only add existing bands to favorites list and function should return an error if they add a
band not in the database. You may add your favorite bands to the template provided, just remember to add matching
genresubgenre and regioncountry
Extra Credit: Create a User with "Paul Pena" and "The Hu in their favorites list. Create other Users, each with only one of those in
their favorites, each as well as both users with "Tengger Cavalry", "Sade", and "Battuvshin" in their favorites. Modify query # so
that Tengger Cavalry will be ranked first in the results order without using name in the order by Hint: consider country, genre, andor
subgenre.
Submit both the updated SQL file with answers for tasks through and program source code with answers for tasks &
only. These should be concise files in proper format sqltxtpycpp etc and not screenshots, executables, build files or anything
besides your source code preferably a single file for each. Don't forget to comment your source, specifying which task # a query
answers, and to exercise proper security.
CREATE DATABASE IF NOT EXISTS CSCFinal;
USE CSCFinal;
CREATE TABLE IF NOT EXISTS Genre
gid INT NOT NULL AUTOINCREMENT PRIMARY KEY,
gname CHAR NOT NULL
;
INSERT INTO Genre gname VALUES RockJazzCountryClassicalThroat Singing';
CREATE TABLE IF NOT EXISTS SubGenre
sgid INT NOT NULL AUTOINCREMENT PRIMARY KEY,
gname CHAR NOT NULL,
sgname CHAR NOT NULL
;
INSERT INTO SubGenre gname sgname VALUES Rock 'Blues'Rock 'Classic Rock'Rock 'Power Metal'Rock 'Thrash Metal'Rock 'Death Metal'Rock 'Folk Metal';
INSERT INTO SubGenre gname sgname VALUES Jazz 'Swing'Jazz 'Smooth Jazz'Jazz 'Bossa Nova'Jazz 'Ragtime';
INSERT INTO SubGenre gname sgname VALUES Country 'Bluegrass'Country 'Country and Western'Country 'Jug Band';
INSERT INTO SubGenre gname sgname VALUES Classical 'Chamber Music'Classical 'Opera'Classical 'Orchestral';
INSERT INTO SubGenre gname sgname VALUES Throat Singing', 'Khoomii'Throat Singing', 'Kargyraa'Throat Singing', 'Khamryn';
CREATE TABLE IF NOT EXISTS Region
rid INT NOT NULL AUTOINCREMENT PRIMARY KEY,
rname CHAR NOT NULL
;
INSERT INTO Region rname VALUES Central Asia'EuropeNorth Americ'South America';
CREATE TABLE IF NOT EXISTS Country
rid INT NOT NULL AUTOINCREMENT PRIMARY KEY,
rname CHAR NOT NULL,
cname CHAR NOT NULL
;
INSERT INTO Country rname cname VALUES Central Asia', 'Mongolia'Central Asia', 'Tibet'Central Asia', 'Tuva';
INSERT INTO Country rname cname VALUES North Americ', 'Canada'North Americ', 'United States'North Americ', 'Mexico';
INSERT INTO Country rname cname VALUES South Americ', 'Brazil';
INSERT INTO Country rname cname VALUES Europe 'Norway'Europe 'Austria'Europe 'England'Europe 'Russia';
CREATE
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