Question

In: Computer Science

1.We sell music  to our members. Employees recommend titles by rating them from1 to 5 with 1...

1.We sell music  to our members. Employees recommend titles by rating them from1 to 5 with 1 being not very good to 5 being very good

What would your strategy be to write SQL code for the following query: "Show all the members and the sale dates of products they bought if they bought any products"

I would use a left outer join

I would not use a join because the data comes from one table

I would use an equality join to find matching records in two or more tables by matching primary and foreign keys

I would use a subquery

I would use a recursive join to join a table to itself

2.

We sell music  to our members. Employees recommend titles by rating them from1 to 5 with 1 being not very good to 5 being very good

What would your strategy be to write SQL code for the following query: "Show every artist and product we carry and the sale date of the product it it has ever been sold"

I would use a left outer join

I would not use a join because the data comes from one table

I would use a subquery

I would use an equality join to find matching records in two or more tables by matching primary and foreign keys

I would use a recursive join to join a table to itself

Solutions

Expert Solution

For the 1st one, I will use the an equality join to find the matching records in two or more tables by matching primary and foreign keys

Description: Here we need Member, Title and Price of the product member have bought. These details are existing in 3 different tables : Member, Sale and Product. (This negates the second option that says that data comes from a single table). As we need the details of the members who bought the product we will need to use the equality join, which works by comparing the Primary and Foreign keys.
We cannot use the LEFT JOIN as that will generate extra rows e.g. if we keep Product table as left most table then our query will give data for those products as well for which no sale has been done. We will not use subquery as there is no conditional checking required. We will not use the recursive join as that is mainly used for comparing the rows of a table with itself which is not required.

For 2nd :

I will use left outer join of product and sale table as we need every artist as result and sales if any per product
Query will be
SELECT * FROM Product LEFT JOIN Sale ON Product.productid == Sale.productid

Please do upvote thank you.


Related Solutions

Katy, a manager, is evaluating her team members by rating them from best to worst. This...
Katy, a manager, is evaluating her team members by rating them from best to worst. This rating is based on their overall performance. Which of the following performance-appraisal methods is Katy using in the given scenario? choose from below. The simple ranking method The factor-comparison method The critical incident method The forced-distribution method
For the result of Performance rating and Aptitude test of the following 5 employees answer the...
For the result of Performance rating and Aptitude test of the following 5 employees answer the following questions: Draw Scatter Plot Coefficient of Correlation and its interpretation Coefficient of Determination and Non-Determination and their interpretation Regression line and interpretation of that. Where does the line crosses the y-axis At Aptitude test result of 59 what is the residual? What is your predicted Performance rating at Aptitude test result of 85!? At 0.05 Significance level is the association between the two...
We developed a new product, and our management believes that it will sell for one or...
We developed a new product, and our management believes that it will sell for one or two years before it is obsolete. Management thinks that there is 4 alternative options with this new product. The following Payoff table demonstrates all the options and the nature of each decision. Suppose a prior probability of 0.75 of the product becoming obsolete in 1 year. Alternatives Obsolete in 1 year [ 0.75 ] Obsolete in 2 year [ 0.25 ] Sell patents now...
COLLAPSE Overall Rating: 1 2 3 4 5 Your Rating: 1 2 3 4 5 "Sikh...
COLLAPSE Overall Rating: 1 2 3 4 5 Your Rating: 1 2 3 4 5 "Sikh Rituals and Practices"  Please respond to the following in at least 250 words and include any sources you use: What are the key beliefs and practices in Sikhism? From the religions we have studied so far, identify the religion that you believe has the most in common with Sikhism. Explain your choice by discussing at least three comparative aspects of these two religions. Which one...
When we think of antibodies, we normally think of them as our own body's way of...
When we think of antibodies, we normally think of them as our own body's way of defending us against pathogens. Antibodies, however, have also been used as a therapeutic treatment for certain diseases. Specifically, Ebola virus has been treated by using antibodies from reconvalescent patients. Explain why this treatment method works, and why you think it is more effective than antivirals. Also discuss how practical/feasible this type of treatment would be if there were to be a large-scale outbreak of...
So in our Ochem TLC experiment. We prepared some of our solid samples dissolving them in...
So in our Ochem TLC experiment. We prepared some of our solid samples dissolving them in ethanol, and we prepared our liquid samples by mixxing them with dichloromethane. My question is... Why doesn’t it matter that some of the samples are prepared using ethanol as a solvent and other samples are prepared using dichloromethane as a solvent? [Hint: What happens to this solvent after you deposit a spot of solution to the TLC plate?]
It is only July and we have run short of funds to pay our employees for...
It is only July and we have run short of funds to pay our employees for the remainder of this year. As a result, we need to seek creative ways to help the company weather the storm... get through this problem. However, after conducting a series of brainstorming sessions, we are really no further ahead than we were before, so we have decided to hire an outside consulting firm, i.e. YOU, to help us decide upon the best option to...
Our group have selected durian fruit as a product and we are going to sell a...
Our group have selected durian fruit as a product and we are going to sell a product in China market. so please guide me on the following question:: 1. What are the factors your group has to consider when selecting distribution channels? 2. What type of distribution channels will you use for your product?
1. Members of a company are allowed to sell their shares at any time, provided they obtain permission from the other members.
  1. Members of a company are allowed to sell their shares at any time, provided they obtain permission from the other members. 2. Australian accounting standards are now identical to their equivalent International Financial Reporting Standards (IFRSs). 3. Prior to the allotment/issue of shares, the balance in the application account represents a liability of the company to the applicants. 4. If a company forfeits shares and the company’s constitution is silent in relation to reissue of the shares, the...
Files and folders; we all use them today on our varying computer devices. 1. State briefly...
Files and folders; we all use them today on our varying computer devices. 1. State briefly what you understand a file extension to be and what its purpose is. 2. Identify three file extensions that you see and which software applications may have created them. 3. Reason to have our files and folders properly managed. Formulate your discussion points/posting comprising 400 – 600 words based on the above questions
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT