sql queries for oracle database. b) (8 points) Write the database schema for this ER diagram. c)
Fantastic news! We've Found the answer you've been seeking!
Question:
sql queries for oracle database.
Transcribed Image Text:
b) (8 points) Write the database schema for this ER diagram. c) (8 points) Write the CREATE TABLE statements for all tables identified for this database. The create statements have to work when ran against the Oracle database. The create statements have to be written in an order such that if executed in that order will not cause any error. Question 3) (40 points) (provide your answers of this in an SQL file) Given the following schema: songs(songid: int, title string, release: date) singers (singerid: int, name: string, city: string, state:string) singsin(singerid:int, songid:int) The primary keys are underlined in each relation. Relation singers contains information about singers. Relation songs contain information about songs. Relation singsin contains information about singers singing songs. Notes: SQL must run against the Oracle database we use in class. (Please run and test your queries against the Oracle DB. Create the tables, insert some data, and test your queries!!!) SQL queries that do not run against the Oracle db will receive 0 points In the .sql file, before each SQL statement you MUST include a comment line with the problem number the sql statement is for (e.g., before writing the SQL query for (c) add a comment line such as --Answer for c)). Remember that a comment line starts with two dash symbols. Any other additional comments can be written in comment lines. For CS430 students, each problem (a through h) carries 5 points possible. For cs630 students, each problem (a through j) carries 4 points possible. a) Write the SQL statements that create tables songs, singers and singsin. Don't forget to define the key constraints. b) Write the SQL query that extracts all the names of the singers from state MA. Sort the result by name in descending order. c) Write the SQL query that extracts information about the singers and the songs they sing. Each record in the result should contain the name of the singer, the title of the song and the release date of the song. d) Write the SQL query that finds how many singers from Boston, MA are in the database. e) Write the SQL that extracts information about singers whose name starts with letter A. Sort the result by the state of the singers, in an ascending order. f) Write the SQL that extracts the name, city and state for all singers who played in a song that has a title that contains the word joy. The query should be case insensitive with regards to the case of the letters from the title of the song. g) Write an SQL query to extract the name, city and state of singers that sang a song that was released before Sept 1, 2021. h) Write the SQL to extracts the name and state of singers that sang some songs released in year 2020. The results should contain no duplicates. i) [CS630 only] Write the SQL query to extract the id, name and city of singers that are from MA and sang some songs released between Jan 1, 2020 and July 31, 2022. Sort the result by the name of the singers in descending order. j) [CS630 only] Write the SQL to extract the number of unique singers that sang some song released after Dec 10, 2021. b) (8 points) Write the database schema for this ER diagram. c) (8 points) Write the CREATE TABLE statements for all tables identified for this database. The create statements have to work when ran against the Oracle database. The create statements have to be written in an order such that if executed in that order will not cause any error. Question 3) (40 points) (provide your answers of this in an SQL file) Given the following schema: songs(songid: int, title string, release: date) singers (singerid: int, name: string, city: string, state:string) singsin(singerid:int, songid:int) The primary keys are underlined in each relation. Relation singers contains information about singers. Relation songs contain information about songs. Relation singsin contains information about singers singing songs. Notes: SQL must run against the Oracle database we use in class. (Please run and test your queries against the Oracle DB. Create the tables, insert some data, and test your queries!!!) SQL queries that do not run against the Oracle db will receive 0 points In the .sql file, before each SQL statement you MUST include a comment line with the problem number the sql statement is for (e.g., before writing the SQL query for (c) add a comment line such as --Answer for c)). Remember that a comment line starts with two dash symbols. Any other additional comments can be written in comment lines. For CS430 students, each problem (a through h) carries 5 points possible. For cs630 students, each problem (a through j) carries 4 points possible. a) Write the SQL statements that create tables songs, singers and singsin. Don't forget to define the key constraints. b) Write the SQL query that extracts all the names of the singers from state MA. Sort the result by name in descending order. c) Write the SQL query that extracts information about the singers and the songs they sing. Each record in the result should contain the name of the singer, the title of the song and the release date of the song. d) Write the SQL query that finds how many singers from Boston, MA are in the database. e) Write the SQL that extracts information about singers whose name starts with letter A. Sort the result by the state of the singers, in an ascending order. f) Write the SQL that extracts the name, city and state for all singers who played in a song that has a title that contains the word joy. The query should be case insensitive with regards to the case of the letters from the title of the song. g) Write an SQL query to extract the name, city and state of singers that sang a song that was released before Sept 1, 2021. h) Write the SQL to extracts the name and state of singers that sang some songs released in year 2020. The results should contain no duplicates. i) [CS630 only] Write the SQL query to extract the id, name and city of singers that are from MA and sang some songs released between Jan 1, 2020 and July 31, 2022. Sort the result by the name of the singers in descending order. j) [CS630 only] Write the SQL to extract the number of unique singers that sang some song released after Dec 10, 2021.
Expert Answer:
Related Book For
Data Modeling and Database Design
ISBN: 978-1285085258
2nd edition
Authors: Narayan S. Umanath, Richard W. Scammel
Posted Date:
Students also viewed these databases questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
What does the following code fragment print? String \(s=\) "He11o World"; s. toUpperCase(); s. substring (6, 11); StdOut.println(s);
-
On July 1, 2015, Ketchikan Inc. borrowed $90,000 to finance the purchase of machinery. The terms of the mortgage require payments to be made at the end of every month with the first payment of $1,589...
-
Create a new variable that adds 10 points to everyone's math background quiz score. How does the sum of this variable compare to the sum of the original variable? What general rule is being...
-
What is a compilation unit?
-
Cole Corporation operates three investment centers. The following financial statements apply to the investment center named Morrison Division. MORRISON DIVISION Income Statement For the Year Ended...
-
Calculate the output of the neural network illustrated below figure 1 using the following activation functions. Consider all the weight values are equal to 1 . a . Binary Sigmoidal ( logsig )...
-
1. Annuities forum topic. 2. Welcome to forum 2 of the Financial Mathematics subject whose objective is to identify what annuities are and the types of annuities that exist. 3. Questions from the...
-
Think of a particular segment of the mass audience that could be served by a magazine but doesn't seem to be, and write the cover magazine for that audience. In a short paragraph, describe the...
-
1. What is NOT a constraint of embedded systems? A. have limited signal range B. difficult or impossible to patch C. usually no MFA D. most users know about their vulnerabilities 2....
-
Initial investment is 2550000.00, fcf is 750000.00 what is the present value for year one if the interest is 7%?
-
What audit standards and PSAK were violated regarding the Sunprima Nusantara Pembinaan (SNP Finance) case?
-
3. Consider a fully associative TLB with a capacity of 16 virtual-to-physical page translations. Assuming that the physical memory has a capacity of 32K pages, each 2KB in size, answer the following:...
-
What is your opinion on the usage of the flatpak and snap packages? 1) Description on flatpak and snap package 2) How to use them? 3) Opinion of the future Linux package management system if using...
-
Find the market equilibrium point for the following demand and supply functions. Demand: 2p = - q + 56 Supply: 3p - q = 34
-
This exercise is based on the data sets associated with Figure 2.25 in Chapter 2. a. Use the SQL Data Definition Language to create a relational schema that consists of the following three relations:...
-
What is a join dependency and in what way is it related to a multi-valued dependency?
-
What is the value of using role names to describe the participation of an entity type in a relationship type?
-
A blender does 5000 J of work on the food in its bowl. During the time the blender runs, 2000 J of heat is transferred from the warm food to the cooler environment. What is the change in the thermal...
-
Which system contains more atoms: 5 mol of helium (A = 4) or 1 mol of neon (A = 20)? A. Helium B. Neon C. They have the same number of atoms.
-
A sample of ideal gas is in a sealed container. The temperature of the gas and the volume of the container are both increased. What other properties of the gas necessarily change? (More than one...
Study smarter with the SolutionInn App