-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBig_Mart_Sales_db.sqbpro
388 lines (171 loc) · 7.01 KB
/
Big_Mart_Sales_db.sqbpro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<?xml version="1.0" encoding="UTF-8"?><sqlb_project><db path="Big_Mart_Sales_db.db" readonly="0" foreign_keys="1" case_sensitive_like="0" temp_store="0" wal_autocheckpoint="1000" synchronous="2"/><attached/><window><main_tabs open="structure browser pragmas query" current="3"/></window><tab_structure><column_width id="0" width="300"/><column_width id="1" width="0"/><column_width id="2" width="100"/><column_width id="3" width="1904"/><column_width id="4" width="0"/><expanded_item id="0" parent="1"/><expanded_item id="1" parent="1"/><expanded_item id="2" parent="1"/><expanded_item id="3" parent="1"/></tab_structure><tab_browse><table title="Big_Mart" custom_title="0" dock_id="1" table="4,8:mainBig_Mart"/><dock_state state="000000ff00000000fd00000001000000020000054a00000257fc0100000001fb000000160064006f0063006b00420072006f007700730065003101000000000000054a0000013300ffffff0000054a0000000000000004000000040000000800000008fc00000000"/><default_encoding codec=""/><browse_table_settings><table schema="main" name="Big_Mart" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="96"/><column index="2" value="83"/><column index="3" value="113"/><column index="4" value="95"/><column index="5" value="175"/><column index="6" value="71"/><column index="7" value="103"/><column index="8" value="163"/><column index="9" value="73"/><column index="10" value="133"/><column index="11" value="143"/><column index="12" value="115"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table></browse_table_settings></tab_browse><tab_sql><sql name="SQL 1*">SELECT * FROM Big_Mart
/* 1) WRITE a sql query to show all Item_Identifier. */
SELECT
Item_Identifier
FROM Big_Mart
/* 2) WRITE a sql query to show count of total Item_Identifier. */
SELECT
COUNT(Item_Identifier) AS TotalCount
FROM Big_Mart
/* 3) WRITE a sql query to show maximum Item Weight. */
SELECT
MAX(Item_Weight) AS MaxWeight
FROM Big_Mart
/* 4) WRITE a query to show minimun Item Weight. */
SELECT
MIN(Item_Weight) AS MinWeight
FROM Big_Mart
/* 5) WRITE a query to show average Item_Weight.*/
SELECT
ROUND(AVG(Item_weight),2) AS AvgWeight
FROM Big_Mart
/* 6) WRITE a query to show count OF Item_Fat_Content WHERE Item_Fat_Content IS Low Fat.*/
SELECT
COUNT(Item_Fat_Content)
FROM Big_Mart
WHERE Item_Fat_Content = 'Low Fat'
/* 7) WRITE a query to show count OF Item_Fat_Content WHERE Item_Fat_Content IS Regular.*/
SELECT
COUNT(Item_Fat_Content)
FROM Big_Mart
WHERE Item_Fat_Content = 'Regular'
/* 8) WRITE a query TO show maximum Item_MRP.*/
SELECT
MAX(Item_MRP) AS MaxMRP
FROM Big_Mart
/* 9) WRITE a query TO show minimum Item_MRP.*/
SELECT
MIN(Item_MRP) AS MinMRP
FROM Big_Mart
/* 10) WRITE a query to show Item_Identifier , Item_Fat_Content,Item_Type,Item_MRP and Item_MRP IS greater than 200.*/
SELECT
Item_Identifier,
Item_Fat_Content,
Item_Type,
Item_MRP
FROM Big_Mart
WHERE Item_MRP > 200
/* 11) WRITE a query to show maximum Item_MRP WHERE Item_Fat_Content IS Low Fat.*/
SELECT
MAX(Item_MRP) AS MRP
FROM Big_Mart
WHERE Item_Fat_Content = 'Low Fate'
/* 12) WRITE a query to show minimum Item_MRP AND Item_Fat_Content IS Low Fat.*/
SELECT
MIN(Item_MRP) AS MRP
FROM Big_Mart
WHERE Item_Fat_Content = 'Low Fate'
/* 13) WRITE a query to show ALL DATA WHERE item MRP IS BETWEEN 50 TO 100.*/
SELECT
*
FROM Big_Mart
WHERE Item_MRP BETWEEN 50 AND 100
/* 14) WRITE a query to show ALL UNIQUE value Item_Fat_Content.*/
SELECT
DISTINCT(Item_Fat_Content)
FROM Big_Mart
/* 15) WRITE a query to show ALL UNIQUE value Item_Type.*/
SELECT
DISTINCT(Item_Type)
FROM Big_Mart
/* 16) WRITE a query to show ALL DATA IN descending ORDER BY Item MRP.*/
SELECT
*
FROM Big_Mart
ORDER BY Item_MRP DESC
/* 17) WRITE a query to show ALL DATA IN ascending ORDER BY Item_Outlet_Sales.*/
SELECT
*
FROM Big_Mart
ORDER BY Item_Outlet_Sales ASC
/* 18) WRITE a query to show ALL DATA IN ascending BY Item_Type.*/
SELECT
*
FROM Big_Mart
ORDER BY Item_Type
/* 19) WRITE a query to show DATA OF item_type dairy & Meat.*/
SELECT
*
FROM Big_Mart
WHERE Item_Type IN ('Dairy','Meat')
/* 20) WRITE a query to show ALL UNIQUE value OF Outlet_Size.*/
SELECT
DISTINCT(Outlet_Size) AS OutletSize
FROM Big_Mart
/* 21) WRITE a query to show ALL UNIQUE value OF Outlet_Location_Type.*/
SELECT
DISTINCT(Outlet_Location_Type) AS OutletLocationType
FROM Big_Mart
/* 22) WRITE a query to show ALL UNIQUE value OF Outlet_Type.*/
SELECT
DISTINCT(Outlet_Type) AS OutletType
FROM Big_Mart
/* 23) WRITE a query to show count NO. OF item BY Item_Type AND ordered it IN descending.*/
SELECT
Item_Type,
COUNT(Item_type) AS NoofItem
FROM Big_Mart
GROUP BY Item_Type
ORDER BY COUNT(Item_type) DESC
/* 24) WRITE a query to show count NO. OF item BY Outlet_Size AND ordered it IN ascending.*/
SELECT
Outlet_Size,
COUNT(Outlet_Size) AS OutletCount
FROM Big_Mart
GROUP BY Outlet_Size
ORDER BY Outlet_Size
/* 25) WRITE a query TO show count NO. OF item BY Outlet_Establishment_Year AND ordered it IN ascening.*/
SELECT
Outlet_Establishment_Year,
COUNT(Outlet_Establishment_Year)
FROM Big_Mart
GROUP BY Outlet_Establishment_Year
ORDER BY Outlet_Establishment_Year ASC
/*26) WRITE a query to show count NO. OF item BY Outlet_Type AND ordered it IN descending.*/
SELECT
Outlet_Type,
COUNT(Outlet_Type)
FROM Big_Mart
GROUP BY Outlet_Type
ORDER BY Outlet_Type DESC
/* 27) WRITE a query to show maximum MRP BY Item_Type.*/
SELECT
MAX(Item_MRP) AS MaxMRP,
Item_Type
FROM Big_Mart
GROUP BY Item_Type
/* 28) WRITE a query to show average MRP BY Outlet_Size AND ordered IN descending.*/
SELECT
ROUND(AVG(Item_MRP),2) AS MRP,
Outlet_Size
FROM Big_Mart
GROUP BY Outlet_Size
ORDER BY AVG(Item_MRP) DESC
/* 29) WRITE a query to show maximum Item_Outlet_Sales BY Item_Type.*/
SELECT
MAX(Item_Outlet_Sales) AS Sales,
Item_Type
FROM Big_Mart
GROUP BY Item_Type
/* 30) WRITE a query to show total Item_Outlet_Sales BY Item_Type AND ORDER it descending.*/
SELECT
COUNT(Item_Outlet_Sales) TotalSales
FROM Big_Mart
GROUP BY Item_Type
ORDER BY Item_Type DESC
/* 31) WRITE a query to show total Item_Outlet_Sales BY Item_Type but ONLY WHERE Outlet_Location_Type IS Tier 1.*/
SELECT
COUNT(Item_Outlet_Sales) AS TotalSales,
Outlet_Location_Type
FROM Big_Mart
WHERE Outlet_Location_Type = 'Tier 1'
GROUP BY Outlet_Location_Type
/* 32) WRITE a query to show total Item_Outlet_Sales BY Item_Type WHERE Item_Fat_Content IS ONLY Low Fat & LF.*/
SELECT
COUNT(Item_Outlet_Sales) AS TotalSales,
Item_Type
FROM Big_Mart
WHERE Item_Fat_Content IN ('Low Fat', 'LF')
GROUP BY Item_Type
ORDER BY COUNT(Item_Outlet_Sales)
</sql><current_tab id="0"/></tab_sql></sqlb_project>