Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1fea211

Browse files
Add files via upload
1 parent bec37e7 commit 1fea211

File tree

1 file changed

+181
-0
lines changed

1 file changed

+181
-0
lines changed
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
{
2+
"nbformat": 4,
3+
"nbformat_minor": 0,
4+
"metadata": {
5+
"colab": {
6+
"provenance": []
7+
},
8+
"kernelspec": {
9+
"name": "python3",
10+
"display_name": "Python 3"
11+
},
12+
"language_info": {
13+
"name": "python"
14+
}
15+
},
16+
"cells": [
17+
{
18+
"cell_type": "markdown",
19+
"source": [
20+
"# SQL Statements and Operators\n",
21+
"\n",
22+
"---------"
23+
],
24+
"metadata": {
25+
"id": "tzVz-FQDy4J4"
26+
}
27+
},
28+
{
29+
"cell_type": "markdown",
30+
"source": [
31+
"Pattern Matching\n",
32+
"-----------\n",
33+
"\n",
34+
"What would be the output of the following query: 'select * from employee where first_name like \"%ee%\";'?\n",
35+
"\n",
36+
"---------------\n",
37+
"\n",
38+
"Answer:\n",
39+
"------------\n",
40+
"\n",
41+
"It will display the details of all the employees whose name contains ‘ee’.\n",
42+
"\n",
43+
"--------------\n",
44+
"\n",
45+
"Feedback:\n",
46+
"--------------\n",
47+
"\n",
48+
"The % character can replace any number of preceding and trailing characters.\n",
49+
"\n",
50+
"----------------"
51+
],
52+
"metadata": {
53+
"id": "6vktS4URwUif"
54+
}
55+
},
56+
{
57+
"cell_type": "markdown",
58+
"source": [
59+
"Reading the Documentation\n",
60+
"------------\n",
61+
"\n",
62+
"Refer to the MySQL documentation online and answer the following question:\n",
63+
"\n",
64+
"Which of the following wildcards are supported in SQL?\n",
65+
"\n",
66+
"-------------------\n",
67+
"\n",
68+
"Both % and _ (underscore)\n",
69+
"\n",
70+
"----------\n",
71+
"\n",
72+
"% is a multi-character wildcard, whereas _ is a single-character wildcard. For example, using \"_r%\" would return the words with the second character as r, followed by zero or more characters at the end.\n",
73+
"\n",
74+
"-----------------"
75+
],
76+
"metadata": {
77+
"id": "Xc2fxj6ywnka"
78+
}
79+
},
80+
{
81+
"cell_type": "markdown",
82+
"source": [
83+
"Operators\n",
84+
"----------\n",
85+
"\n",
86+
"With SQL, how do you select all the records from a table named ‘employees’ where the ‘LastName’ is alphabetically between (and includes) ‘Joshi’ and ‘Sharma’?\n",
87+
"\n",
88+
"----------------\n",
89+
"\n",
90+
"select * from employees where LastName between ‘Joshi’ and ‘Sharma’;\n",
91+
"\n",
92+
"-----------------\n",
93+
"\n",
94+
"This query will return employees who have Joshi and Sharma as surnames, along with all the surnames that are in-between alphabetically.\n",
95+
"\n",
96+
"----------------"
97+
],
98+
"metadata": {
99+
"id": "rMTHjhq3w2A_"
100+
}
101+
},
102+
{
103+
"cell_type": "markdown",
104+
"source": [
105+
"Operators\n",
106+
"--------\n",
107+
"\n",
108+
"Which of the queries given below would return the same output? \n",
109+
"\n",
110+
"More than one option may be correct.\n",
111+
"\n",
112+
"-----------------\n",
113+
"\n",
114+
"select * from employees where EmpID in (2,3,4, 5);\n",
115+
"\n",
116+
"select * from employees where EmpID between 2 and 5;\n",
117+
"\n",
118+
"select * from employees where EmpID >= 2 and EmpID <= 5;\n",
119+
"\n",
120+
"--------------\n",
121+
"\n",
122+
"Feedback:\n",
123+
"\n",
124+
"This query will return the details of the employees with employee ids 2, 3, 4 and 5.\n",
125+
"\n",
126+
"-------------------"
127+
],
128+
"metadata": {
129+
"id": "3m0ocQS3xtJc"
130+
}
131+
},
132+
{
133+
"cell_type": "markdown",
134+
"source": [
135+
"Basic Select\n",
136+
"------------\n",
137+
"\n",
138+
"Description\n",
139+
"\n",
140+
"Consider the following table employees containing the following columns:\n",
141+
"\n",
142+
"Employees\n",
143+
"\n",
144+
"![](https://media-doselect.s3.amazonaws.com/generic/OqNgkRAgJpJMpzxNJZMXNdYXR/Employee_Table.PNG)\n",
145+
"\n",
146+
"Write a query to determine the first names of all employees.\n",
147+
"\n",
148+
"----------------------\n",
149+
"\n",
150+
"Query\n",
151+
"--------\n",
152+
"\n",
153+
" use upgrad;\n",
154+
"\n",
155+
" # Write your code below\n",
156+
" select firstname from Employees;"
157+
],
158+
"metadata": {
159+
"id": "Q8CZlJQCx-r0"
160+
}
161+
},
162+
{
163+
"cell_type": "markdown",
164+
"source": [
165+
"# Aggregate Functions\n",
166+
"\n",
167+
"----------------"
168+
],
169+
"metadata": {
170+
"id": "qQZe8ziryPMX"
171+
}
172+
},
173+
{
174+
"cell_type": "markdown",
175+
"source": [],
176+
"metadata": {
177+
"id": "wjMfsR4eyoeY"
178+
}
179+
}
180+
]
181+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /