Q211
Q211 Correct the syntax error in "UPDATE Products SET Price = Price * 1.1 WHERE Price < 100 OR Price > 200;"
Change '*' to '+' in 'Price * 1.1'
Remove 'OR Price > 200'
Replace 'WHERE' with 'AND'
No error
Q212
Q212 What is incorrect in "SELECT EmployeeID, Salary FROM Employees WHERE Salary BETWEEN 30000 AND 50000;"?
Change 'BETWEEN' to 'IN'
Replace 'AND' with 'OR'
Change 'Salary' to 'TotalSalary'
No error
Q213
Q213 In "SELECT Name FROM Employees WHERE NOT (Age < 30 AND Department = 'Sales');", identify the error.
Replace 'NOT' with 'NO'
Change 'AND' to 'OR'
Remove parentheses around condition
No error
Q214
Q214 Identify the mistake in
"SELECT * FROM Employees WHERE Department = 'HR' XOR Department = 'Finance';"
XOR operator
= 'HR'
= 'Finance'
No mistake, the statement is correct
Q215
Q215 What needs to be changed in "UPDATE Employees SET Salary *= 2 WHERE YearsOfExperience > 5;"?
Change '*=' to '=:='
Remove 'WHERE YearsOfExperience > 5'
Replace '2' with '2.0'
No error
Q216
Q216 What does the WHERE clause do in an SQL query?
Sorts the result set
Filters rows before grouping
Joins tables
Filters rows after grouping
Q217
Q217 What is the purpose of the ORDER BY clause in SQL?
Filters rows
Sorts the result set
Groups rows
Joins tables
Q218
Q218 In SQL, how does the GROUP BY clause function when combined with an aggregate function like SUM or COUNT?
It calculates the aggregate for the entire table
It groups rows based on unique values in a column and calculates the aggregate for each group
It filters the rows before aggregation
It sorts the result set
Q219
Q219 What is the main difference between WHERE and HAVING clauses in SQL?
WHERE filters rows before grouping, HAVING filters rows after grouping
HAVING filters rows before grouping, WHERE filters rows after grouping
No difference
WHERE is used with aggregate functions, HAVING is not
Q220
Q220 In an SQL query, what role does HAVING play without a GROUP BY clause?
It functions as a WHERE clause
It has no effect
It causes an error
It filters aggregated results
Q221
Q221 How does the ORDER BY clause treat NULL values by default?
It places them at the beginning of the result set
It places them at the end of the result set
It ignores them
It causes an error
Q222
Q222 What happens if you use a column in the SELECT statement that is not in the GROUP BY clause?
The query fails
The query succeeds, and the column shows arbitrary values
The query is automatically corrected
The column is ignored
Q223
Q223 Can the ORDER BY clause use column aliases defined in the SELECT statement?
Yes
No
Only if they are numerical
Only in subqueries
Q224
Q224 What is the effect of combining GROUP BY with ORDER BY in an SQL query?
GROUP BY overrides ORDER BY
ORDER BY overrides GROUP BY
They can be used together for organized grouping and sorting
They cannot be used together in the same query
Q225
Q225 In SQL, can the HAVING clause be used without an aggregate function?
Yes, it acts like a WHERE clause
No, it must be used with an aggregate function
Yes, but it has no effect
No, it causes an error
Q226
Q226 What is incorrect in "SELECT Name FROM Employees WHERE Department = 'Sales' ORDER BY Age;"?
Replace 'ORDER BY Age' with 'GROUP BY Age'
Change 'WHERE Department = 'Sales'' to 'WHERE Department IN ('Sales')'
Remove 'Name FROM'
No error
Q227
Q227 Identify the error in
"SELECT Department, COUNT(*) FROM Employees GROUP BY Salary;"
SELECT Department
COUNT(*)
GROUP BY Salary
No error
Q228
Q228 What needs to be corrected in
"SELECT AVG(Salary) AS AverageSalary FROM Employees HAVING AverageSalary > 50000;"?
SELECT AVG(Salary)
AS AverageSalary
FROM Employees
HAVING AverageSalary > 50000
Q229
Q229 Correct the syntax error in
"SELECT Name, Department, COUNT(*) FROM Employees WHERE Department = 'Sales' GROUP BY Department;"
SELECT Name
Department
COUNT(*)
WHERE Department = 'Sales'
Q230
Q230 In "SELECT Department, SUM(Salary) FROM Employees GROUP BY Department HAVING COUNT(*) > 5;", identify the error.
Replace 'SUM(Salary)' with 'AVG(Salary)'
Change 'GROUP BY' to 'ORDER BY'
Change 'COUNT(*)' to 'COUNT(Department)'
No error
Q231
Q231 What is incorrect in "SELECT * FROM Employees ORDER BY 3;"?
Change 'ORDER BY 3' to 'ORDER BY ID'
Replace '*' with 'EmployeeID, Name'
Add 'WHERE' clause before 'ORDER BY'
No error
Q232
Q232 Identify the mistake in
"SELECT Department, MAX(Salary) FROM Employees WHERE MAX(Salary) > 50000 GROUP BY Department;"
SELECT Department
MAX(Salary)
WHERE MAX(Salary) > 50000
GROUP BY Department
Q233
Q233 In "SELECT Department, COUNT(EmployeeID) FROM Employees GROUP BY Department HAVING COUNT(EmployeeID) > ALL (SELECT COUNT(EmployeeID) FROM Employees GROUP BY Department);" what needs correction?
Change 'COUNT(EmployeeID)' to 'SUM(EmployeeID)'
Replace 'GROUP BY' with 'ORDER BY'
Alter 'ALL' to 'ANY'
No error
Q234
Q234 Correct the error in
"SELECT Name FROM Employees WHERE Department IN (SELECT Department FROM Departments WHERE Location = 'New York') ORDER BY Name GROUP BY Department;"
WHERE Department IN
ORDER BY Name
GROUP BY Department
No error
Q235
Q235 What is wrong in
"SELECT Department, COUNT(*) AS TotalEmployees FROM Employees GROUP BY Department HAVING TotalEmployees > 5 ORDER BY TotalEmployees;"?
SELECT Department
COUNT(*) AS TotalEmployees
HAVING clause misuse
ORDER BY TotalEmployees
Q236
Q236 What is the main difference between UNION and UNION ALL in SQL?
UNION removes duplicates, UNION ALL does not
UNION ALL removes duplicates, UNION does not
No difference
UNION is faster than UNION ALL
Q237
Q237 What needs to be corrected in "SELECT Name FROM Employees UNION ALL SELECT Name FROM Managers;"?
Change 'UNION ALL' to 'UNION'
Replace first 'SELECT Name' with 'SELECT EmployeeName'
Add 'WHERE' clause to both SELECT statements
No error
Q238
Q238 Identify the error in
"SELECT Name, Department FROM Employees UNION SELECT Name FROM Managers;"
The UNION keyword
The number of columns in SELECT statements
The table names
No error
Q239
Q239 What does an INNER JOIN do in SQL?
Joins rows that satisfy a condition in either table
Joins all rows from both tables
Joins rows with matching values in both tables
Joins rows that do not match in either table
Q240
Q240 What is the main characteristic of a FULL OUTER JOIN?
It combines all records from both tables when there are no matches
It only joins rows with matching values in both tables
It excludes all unmatched rows
It joins rows that satisfy a condition in either table