Question

LIKE(person, sport), PRACTICE(person, sport), where person and sport are keys in both tables. The table LIKE...

LIKE(person, sport), PRACTICE(person, sport), where person and sport are keys in both tables. The table LIKE gives the sports a person likes, the table PRACTICE gives the sports a person practices. We assume that a person likes at least one sport and practices at least one sport. We assume also that a person does not like a sport if the sport is not listed among the sports that person likes Express the following queries in Calculus List pairs of people who practice at least one common sport List the people who like all the sports they practice List the people who practice all the sports they like List the people who practice all the sports John likes

Homework Answers

Answer #1

1. List pairs of people who practice at least one common sport

select PRACTICE.sport,PRACTICE.person 
from PRACTICE
Group by sport, person
Having count(person)>=2

2. List the people who like all the sports they practice

select person as practice_person from PRACTICE
where sport in (
select sport from LIKE where person = practice_person)

3. List the people who practice all the sports they like

select person as like_person from LIKE

where sport in (

select sport from PRACTICE where person = like_person)

4. List the people who practice all the sports John likes

select John as like_person from LIKE

where sport in (

select sport from PRACTICE where John = like_person)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Consider the following database schema: LIKE(person, sport), PRACTICE(person, sport), where person and sport are keys in...
Consider the following database schema: LIKE(person, sport), PRACTICE(person, sport), where person and sport are keys in both tables. The table LIKE gives the sports a person likes, the table PRACTICE gives the sports a person practices. We assume that a person likes at least one sport and practices at least one sport. We assume also that a person does not like a sport if the sport is not listed among the sports that person likes Express the following queries in...
Consider the following database schema: LIKE(person, sport), PRACTICE(person, sport), where person and sport are keys in...
Consider the following database schema: LIKE(person, sport), PRACTICE(person, sport), where person and sport are keys in both tables. The table LIKE gives the sports a person likes, the table PRACTICE gives the sports a person practices. We assume that a person likes at least one sport and practices at least one sport. We assume also that a person does not like a sport if the sport is not listed among the sports that person likes Express the following queries in...
Practice writing SQL queries ----------------------------- For this question, we will consider the following tables about people,...
Practice writing SQL queries ----------------------------- For this question, we will consider the following tables about people, grades, and courses. Your task is to express each of the given queries in SQL. Example data are provided in these tables for your convenience but note that they are only example data. Your queries must work for all potential data residing in the given tables, not just those illustrated here. People (id, name, age, address) --------------------------------------------------- p1 | Tom Martin| 24 | 11,...
Look at the two tables below, which show, respectively, the willingness to pay and willingness to...
Look at the two tables below, which show, respectively, the willingness to pay and willingness to accept of buyers and sellers of bags of oranges. For the following questions, assume that the equilibrium price and quantity will depend on the indicated changes in supply and demand. Assume that the only market participants are those listed by name in the two tables. Also assume that each individual purchases or sells one bag of oranges. Consumers Producers Person Maximum Price Willing to...
***This is a complete question. Do not tag this as incomplete. Write SQL queries to the...
***This is a complete question. Do not tag this as incomplete. Write SQL queries to the below Relational Database. • Regarding the SQL queries: • Do not use SELECT * in any query. • Do not use any SQL features (including Nullif) that were not covered in this course. • Do not use subqueries IF joins can be used to answer a question. However, some questions may require the use of subqueries. The Movie Database Notes: TheaterNum, MovieNum, and ActorNum...
Problem 1: Relations among Useful Discrete Probability Distributions. A Bernoulli experiment consists of only one trial...
Problem 1: Relations among Useful Discrete Probability Distributions. A Bernoulli experiment consists of only one trial with two outcomes (success/failure) with probability of success p. The Bernoulli distribution is P (X = k) = pkq1-k, k=0,1 The sum of n independent Bernoulli trials forms a binomial experiment with parameters n and p. The binomial probability distribution provides a simple, easy-to-compute approximation with reasonable accuracy to hypergeometric distribution with parameters N, M and n when n/N is less than or equal...
ACT Prep Course. ACT prep courses like to market that you can increase your ACT score...
ACT Prep Course. ACT prep courses like to market that you can increase your ACT score by taking their courses. Some statisticians were curious how effective these courses really were. They decided to investigate the truth of the claim by measuring the average score increase for a random sample of students selected to take an ACT prep course. These students took the ACT twice, once before and once after taking the course. The variable of interest was the increase in...
TOMS SHOES –Case Study Founded in 2006 by BLAKE MYCOSKIE, TOMS Shoes was an American footwear...
TOMS SHOES –Case Study Founded in 2006 by BLAKE MYCOSKIE, TOMS Shoes was an American footwear company based in Santa Monica, California. Although TOMS Shoes was a for-profit business, its mission was more like that of a not-for-profit organization. The firm’s reason for existence was to donate to children in need one new pair of shoes for every pair of shoes sold. Blake Mycoskie referred to it as the company’s “One for One” business model. While vacationing in Argentina during...
PLEASE READ THE ARTICLES ATTACHED AND ANSWER THE FOLLOWING QUESTION. THE ARTICLES ARE BOTH LISTED PLEASE...
PLEASE READ THE ARTICLES ATTACHED AND ANSWER THE FOLLOWING QUESTION. THE ARTICLES ARE BOTH LISTED PLEASE PROVIDE DETAILED EXPLANATIONS. PLEASE WRITE ONE REFLECTION COMBINING BOTH ARTICLES. The purpose of the Article Reflection is to deepen your engagement with the topic of Epidemiology. It will give you the opportunity to reflect on the current real-life epidemiological issues at hand and help to bring meaning to them. ARTICLE 1: A group of students knew they had covid-19. They hosted a party over...
Read the case and answer the following Multiple choice questions. There are 5 questions total, where...
Read the case and answer the following Multiple choice questions. There are 5 questions total, where some of them might have more than one correct answers. You can choose more than one options where you think is suitable for the above question. PERFORMANCE MANAGEMENT Project Manager Oliver Caine skimmed his notes as he waited for Ben Robins to come to the meeting room. He hoped Ben would arrive soon, as he wanted to get the con-versation finished quickly. Ben walked...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT