Question: Open the database of sales.sqlite in SQLite. Write a SQL query to get the following output, sorted by Total from the biggest to smallest number.
- Open the database of sales.sqlite in SQLite.
- Write a SQL query to get the following output, sorted by Total from the biggest to smallest number.
- Take the screenshot of your result, including the SQL query and table output, and paste it Word.
-
Item
Price
Quantity
Total
Candy
1.2
10
12.0
Fruit
0.8
6
4.8
Snacks
0.8
5
4.0
Drinks
1
1
1
File Edit View Help New Database Open Database Write Changes Revert Changes DB Schema Database Structure Browse Data Edit Pragmas Execute SOL Name Tables (3) SQL 1 X > Prices SELECT p. Item, p.Price, s.Quantity, SUM (p.Pricets. Quantity) as Total 2 FROM Prices as p, Sales as s 3 WHERE p. Item == 3. Product 4 GROUP BY p.Item; Sales Item Price Quantity Total 1 Candy 1.2 120 2 Drinks 1 1 1 sqlite_sequence Indices (1) sqlite autoindex_Prices 1 Views (0) Triggers (0) 3 Fruit 0.8 4 48 4 Snacks 0.8 2 4.0 4 Rows returned from: SELECT p. Item, p.Price, s. Quantity, SUM (p.Price*s. Quantity) as Total FROM Prices as p, Sales as s WHERE p. Item == s. Product GROUP BY p. Item; (took 5ms) > 24:40/27:31. Applying the same to a larger table>
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
