You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"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",
0 commit comments