Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Obtener Cantidad de Producto por Categoría | Uniendo Tablas
SQL Intermedio
course content

Contenido del Curso

SQL Intermedio

SQL Intermedio

1. Agrupamiento
2. Subconsultas Anidadas
3. Uniendo Tablas
4. DDL y DML en SQL

book
Obtener Cantidad de Producto por Categoría

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.

Tarea
test

Swipe to show code editor

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 OR condition in parentheses before applying the AND operator. 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.name and product.amount columns from the product table.
  • Assign the alias product_name to the first column and amount to the second.
  • Join the category table on the common column product.category_id = category.id.
  • Use a WHERE clause requiring that category.name equals 'Meat' or 'Grains'.
  • Use the logical operator AND to also require that product.amount < 100.
  • Sort the results by product.name.

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 4
toggle bottom row

book
Obtener Cantidad de Producto por Categoría

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.

Tarea
test

Swipe to show code editor

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 OR condition in parentheses before applying the AND operator. 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.name and product.amount columns from the product table.
  • Assign the alias product_name to the first column and amount to the second.
  • Join the category table on the common column product.category_id = category.id.
  • Use a WHERE clause requiring that category.name equals 'Meat' or 'Grains'.
  • Use the logical operator AND to also require that product.amount < 100.
  • Sort the results by product.name.

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 4
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt