Question
(SQL Query Question) The following image is of a database with the tables listed (Food Name, Food Group, Nutrient Name and Nutrient Amount) {Please ignore
(SQL Query Question) The following image is of a database with the tables listed (Food Name, Food Group, Nutrient Name and Nutrient Amount) {Please ignore any other table, just these 4}
Kindly write the following SQL queries to retrieve data from the above database:
1. How many foods have unsalt and canned in the name? Show the nutrient value and the unit for Sodium for those foods?
2. Write a query to calculate how many food names in the Baked Products group start with the letters B, C, or D. Write this query using 3 different ways (I did the first option for this query, just needs 2 more)
OPTION 1:
SELECT COUNT(FoodDescription)
FROM foodgroup, foodname
WHERE FoodGroupName = 'Baked Products'
AND foodgroup.FoodGroupID = foodname.FoodGroupID
AND SUBSTR(FoodDescription, 1, 1) IN ('B', 'C', 'D');
3. How many foods are there for the food group 'Spices and Herbs', listed in the database? Show the food group id, the food group name and the foods count.
YIELD NAME YieldID YieldName YieldName YIELD AMOUNT FoodID YieldID YieldAmount YieldDateOfEntry REFUSE NAME RefuselD RefuseName RefuseName REFUSE AMOUNT FoodID Refusel RefuseAmount RefuseDateOfEntry FOOD GROUP FoodGroupID Food Group Code FoodGroupName FoodGroupNameF MEASURE NAME MeasurelD MeasureName MeasureNameF CONVERSION FACTOR FoodID MeasurelD ConversionFactor Value ConvFactor DateOfEntry FOOD NAME FoodID FoodCode FoodGroupID FoodSourceID FoodDescription FoodDescription CountryCode FoodDateOfEntry FoodDateOfPublication ScientificName FOOD SOURCE FoodSourceID FoodSource Code FoodSource Description FoodSource DescriptionF NUTRIENT NAME NutrientNameID NutrientCode NutrientSymbol Unit NutrientName NutrientNameF Tagname Nutrient Decimals NUTRIENT AMOUNT FoodID NutrientNameld Nutrient SourceID Nutrient Value StandardError NumberOfObservation Nutrient DateOfEntry NUTRIENT SOURCE Nutrient SourcelD Nutrient Source Code NutrientSourceDescription NutrientSource DescriptionF
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