-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueries.sql
More file actions
23 lines (15 loc) · 825 Bytes
/
Copy pathqueries.sql
File metadata and controls
23 lines (15 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- SQL Queries
-- Display first 5 rows
SELECT * FROM orders LIMIT 5
-- Total Sales & Profit
select sum(sales) as total_sales , sum(profit) as total_profit from orders
--Sales by Region/
select region ,sum(sales) as revenue from orders group by region order by revenue desc
--Top Customers
select customer_name ,sum(sales) as Sales_amount from orders group by customer_name order by Sales_amount desc limit 10
--Sales by Category
select category, sum(sales) as total_sales from orders group by category order by total_sales desc
--Profit by Category
select category, sum(profit) as total_profits from orders group by category order by total_profits desc
-- Monthly Sales Trend
select strftime('%Y-%m', order_date) as month, sum(sales) as total_sales from orders group by month order by month