Отримати Кількість Продуктів за Категорією
Now the company has a new task for us.
A new supplier contacted us and said that they can supply goods from the categories Meat or Grains cheaply. We need to find out which products in these categories have less than 100 units left in stock.
Swipe to start coding
Your task is to find the product names and their quantities in stock. Join two tables: product and category.
Focus on products in the Meat or Grains categories. Use the OR operator for these categories and ensure the product quantity is less than 100 using the AND operator.
Sort the results by the name column with the ORDER BY clause.
Note
Wrap the
ORcondition in parentheses before applying theANDoperator. This follows the standard order of operations in discrete mathematics.
Your result should have 2 columns: product_name and amount. Remember to set appropriate aliases!
Brief Instructions
- Retrieve the
product.nameandproduct.amountcolumns from theproducttable. - Assign the alias
product_nameto the first column andamountto the second. - Join the
categorytable on the common columnproduct.category_id = category.id. - Use a
WHEREclause requiring thatcategory.nameequals'Meat'or'Grains'. - Use the logical operator
ANDto also require thatproduct.amount < 100. - Sort the results by
product.name.
Рішення
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Which products in the Meat category have less than 100 units left?
Which products in the Grains category have less than 100 units left?
Can you show me a combined list of all products from Meat and Grains with less than 100 units left?
Awesome!
Completion rate improved to 4
Отримати Кількість Продуктів за Категорією
Свайпніть щоб показати меню
Now the company has a new task for us.
A new supplier contacted us and said that they can supply goods from the categories Meat or Grains cheaply. We need to find out which products in these categories have less than 100 units left in stock.
Swipe to start coding
Your task is to find the product names and their quantities in stock. Join two tables: product and category.
Focus on products in the Meat or Grains categories. Use the OR operator for these categories and ensure the product quantity is less than 100 using the AND operator.
Sort the results by the name column with the ORDER BY clause.
Note
Wrap the
ORcondition in parentheses before applying theANDoperator. This follows the standard order of operations in discrete mathematics.
Your result should have 2 columns: product_name and amount. Remember to set appropriate aliases!
Brief Instructions
- Retrieve the
product.nameandproduct.amountcolumns from theproducttable. - Assign the alias
product_nameto the first column andamountto the second. - Join the
categorytable on the common columnproduct.category_id = category.id. - Use a
WHEREclause requiring thatcategory.nameequals'Meat'or'Grains'. - Use the logical operator
ANDto also require thatproduct.amount < 100. - Sort the results by
product.name.
Рішення
Дякуємо за ваш відгук!
single