SQL Assignment
SQL Assignment
Input Table:
User ID Returns
id2 1000
id5 200
id7 800
2. Below table (Table 1) has city and month wise sales data. Create a SQL query to return
output as illustrated in Table 2.
Table 1
Table 2
Previous Next Month
City Year Month Sales YTD Sales
Month Sales Sales
Delhi 2020 5 4300 2000 4300
Delhi 2020 6 2000 4300 2100 6300
Delhi 2020 7 2100 2000 2200 8400
Delhi 2020 8 2200 2100 1900 10600
Delhi 2020 9 1900 2200 200 12500
Delhi 2020 10 200 1900 12700
Mumbai 2020 5 4400
Mumbai 2020 6 2800
Mumbai 2020 7 6000
Mumbai 2020 8 9300
Mumbai 2020 9 4200
Mumbai 2020 10 9700
Bangalore 2020 5 1000
Bangalore 2020 6 2300
Bangalore 2020 7 6800
Bangalore 2020 8 7000
Bangalore 2020 9 2300
Bangalore 2020 10 8400
Submit the two SQL queries as two separate files with names: <Your full
name>_SQL_ans1 and <Your full name>_SQL_ans2