Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Get Product Amount By Category | Joining Tables
Intermediate SQL
course content

Course Content

Intermediate SQL

Intermediate SQL

1. Grouping
2. Nested Subqueries
3. Joining Tables
4. DDL and DML in SQL

bookGet Product Amount By Category

Great job!

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.

Just a reminder, we are working with two tables:

product:

category:

Task
test

Swipe to show code editor

Your task is to retrieve the product names and their quantities in stock. To do this, you'll need to join two tables. The category of these products should be Meat or Grains. Keep in mind that you'll need to use the OR operator for this. Also, the quantity of the product should be less than 100. To do this, you'll need to use the AND operator.

Also, you need to sort the result by the name column using the ORDER BY clause.

Note

Keep in mind that you should wrap the string with the OR operation in parentheses and then use the AND operator. Here, the standard order of operations from discrete mathematics applies.

As a result, you should have 2 columns: product_name and amount, so don't forget to set appropriate aliases!

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 4
toggle bottom row

bookGet Product Amount By Category

Great job!

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.

Just a reminder, we are working with two tables:

product:

category:

Task
test

Swipe to show code editor

Your task is to retrieve the product names and their quantities in stock. To do this, you'll need to join two tables. The category of these products should be Meat or Grains. Keep in mind that you'll need to use the OR operator for this. Also, the quantity of the product should be less than 100. To do this, you'll need to use the AND operator.

Also, you need to sort the result by the name column using the ORDER BY clause.

Note

Keep in mind that you should wrap the string with the OR operation in parentheses and then use the AND operator. Here, the standard order of operations from discrete mathematics applies.

As a result, you should have 2 columns: product_name and amount, so don't forget to set appropriate aliases!

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 4
toggle bottom row

bookGet Product Amount By Category

Great job!

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.

Just a reminder, we are working with two tables:

product:

category:

Task
test

Swipe to show code editor

Your task is to retrieve the product names and their quantities in stock. To do this, you'll need to join two tables. The category of these products should be Meat or Grains. Keep in mind that you'll need to use the OR operator for this. Also, the quantity of the product should be less than 100. To do this, you'll need to use the AND operator.

Also, you need to sort the result by the name column using the ORDER BY clause.

Note

Keep in mind that you should wrap the string with the OR operation in parentheses and then use the AND operator. Here, the standard order of operations from discrete mathematics applies.

As a result, you should have 2 columns: product_name and amount, so don't forget to set appropriate aliases!

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Great job!

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.

Just a reminder, we are working with two tables:

product:

category:

Task
test

Swipe to show code editor

Your task is to retrieve the product names and their quantities in stock. To do this, you'll need to join two tables. The category of these products should be Meat or Grains. Keep in mind that you'll need to use the OR operator for this. Also, the quantity of the product should be less than 100. To do this, you'll need to use the AND operator.

Also, you need to sort the result by the name column using the ORDER BY clause.

Note

Keep in mind that you should wrap the string with the OR operation in parentheses and then use the AND operator. Here, the standard order of operations from discrete mathematics applies.

As a result, you should have 2 columns: product_name and amount, so don't forget to set appropriate aliases!

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 3. Chapter 4
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt