Challenge: Limit Records

Test what we’ve learned in this chapter with a challange.

We'll cover the following

Problem statement

We have a table that contains seven products. The products table structure is given below:

  • id int(11) represents the primary key.
  • name varchar(255) represents the name of the product.
  • price represents the price of a particular product.

Task

Write a query that returns four rows of the products table so that their price is in descending order.

id	name	                 price
1	Game of Thrones-S01-DVD	 50.00
2	Of Mice and Men	         19.80
3	A Nice Story	         5.00
4	War Games	             70.00
5	Spider Man	             55.80
6	Avengers	             40.00
7	The Godfather	         90.00

We have seven records in products table.

Get hands-on with 1200+ tech skills courses.