Give the count of employees that do not have any flavor preference. Get the numb
ID: 3816895 • Letter: G
Question
Give the count of employees that do not have any flavor preference.
Get the number of customers that have same preference as Patel, M
NEEDED INFORMATION
ICECREAM (Ice_cream_ID, Ice_cream_flavor, price, years_first_offered, sellling _status)
INGREDIENT( Ingredient_ID, Ingredient_name, cost)
RECIPE (Ice_cream_ID, ingredient_ID, quantity_used)
CUSTOMER (Cust_ID, Cust_name, year_born)
Customer_and_Flavor_id (cust_id, Flavor_id)
WHERE:
Ice_cream_ID is the internal Id given to an ice cream.
Ingredient_ID is the internal Id given to an ingredient
selling_staus is an internal control which keeps track of ice cream sales as high, low, medium or none. If no figures are available this field has no value.
Years_first_offered is the year that ice cream was first offered
quantity_used is the amount of ingredient used in a given ice cream
ICECREAM TABLE
INGREDIENT
RECIPE
CUSTOMER
CUSTOMER AND FLAVOR ID
ICE CREAM ID ICE CREAM FLAVOR 101 berry 201 vanilla 211 cherry 311 chocolate 321 strawberry 405 pistachio 406 almond 307 blackberry 510 mint 520 Cookie 525 green tea ICE CREAM ID ICE CREAM FLAVOR 540 raspberry 545 banana 550 pineapple 560 coconut 15 rows selected. PRICE YEAR FIRST OFFERED SELLIN 2010 null 1981 high 2.5 1976 low 1981 high 1961 high 2.5 2012 low 2010 null 2015 null 1.5 1998 medium 2001 medium 4.5 2012 low PRICE YEAR FIRST OFFERED SELLIN 2012 null 1992 medium 1.5 2.5 2001 high 3.25 2012 mediumExplanation / Answer
Question: Give the count of employees that do not have any flavor preference. Here, in this question, I think that there is a typing mistake. I believe it is customer instead of employee.
If it is customer instead of employee then the SQL Query is:
SELECT COUNT(Cust_ID) FROM CUSTOMER WHERE Cust_ID NOT IN (SELECT cust_id FROM Customer_and_Flavor_id);
Note: AS is used to declare a temporary alias/name to a column which makes the column more readable. Here, in this query, instead of showing COUNT(Cust_ID) as the column name it'll show CUSTOMER_WITH_NO_FLAVOR_PREFERENCE. NOT IN is used to confirm that the records must not present in the table returned from the query defined inside.
Question: Get the number of customers that have same preference as Patel, M.
Query:
SELECT COUNT(*) FROM (SELECT DISTINCT Cust_ID FROM Customer_and_Flavor_id WHERE Flavor_id in (SELECT Flavor_id FROM Customer_and_Flavor_id WHERE cust_id = (SELECT Cust_ID FROM CUSTOMER WHERE Cust_name LIKE 'Patel, M')));
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.