Q121
Q121 Identify the error in
"SELECT Name, NULLIF(Age, 30) FROM Employees WHERE Age IS NOT NULL;"
NULLIF
Age
30
No error
Q122
Q122 Correct the syntax error in
"SELECT NVL(Salary, 'Not Provided') FROM Contractors;"
NVL
Salary
'Not Provided'
No syntax error
Q123
Q123 What is incorrect in
"SELECT COALESCE(FirstName, LastName, 'Unknown') FROM Authors;"?
COALESCE
FirstName
LastName
All Correct
Q124
Q124 In "SELECT Name, NVL2(Salary, Salary * 1.1, Salary) AS NewSalary FROM Employees;",
what needs correction?
NVL2
Salary * 1.1
Salary
No error
Q125
Q125 What is the main use of the CASE statement in SQL?
To execute a sequence of commands
To handle errors
To perform if-then-else type logic
To loop through records
Q126
Q126 What needs to be corrected in
"SELECT Name, CASE WHEN Age >= 18 THEN 'Adult' ELSE 'Minor' END FROM Employees;"?
All Correct
CASE WHEN
THEN 'Adult'
ELSE 'Minor'
Q127
Q127 Identify the error in
"SELECT Name, CASE Gender WHEN 'M' THEN 'Male' WHEN 'F' THEN 'Female' END AS Gender FROM Employees;"
CASE Gender
WHEN 'M' THEN 'Male'
WHEN 'F' THEN 'Female'
No error
Q128
Q128 What needs to be corrected in
"SELECT CURRENT_DATE FROM Employees;"?
All Correct
CURRENT_DATE
FROM Employees
The entire query
Q129
Q129 Identify the error in
"SELECT Name, DATEDIFF(year, HireDate, GETDATE()) AS YearsWorked FROM Employees;"
DATEDIFF
year
HireDate
No error
Q130
Q130 Correct the syntax error in
"SELECT Name, DATEADD(MONTH, 6, HireDate) FROM Employees;"
DATEADD
MONTH
6
No syntax error
Q131
Q131 What is incorrect in
"SELECT EXTRACT(MONTH FROM OrderDate) AS OrderMonth FROM Orders;"?
EXTRACT
MONTH FROM
OrderDate
All Correct
Q132
Q132 In "SELECT Name, AGE(BirthDate) AS Age FROM Customers;",
what needs correction?
AGE
BirthDate
AS Age
No error
Q133
Q133 What needs to be corrected in
"SELECT ABS(-123) FROM Dual;"?
All Correct
ABS
-123
FROM Dual
Q134
Q134 Identify the error in
"SELECT Name, CEILING(Salary) FROM Employees WHERE Salary > 0;"
CEILING
Salary
WHERE Salary > 0
No error
Q135
Q135 Correct the syntax error in
"SELECT Name, ROUND(Salary, -2) FROM Employees;"
ROUND
Salary, -2
FROM Employees
No syntax error
Q136
Q136 What is incorrect in
"SELECT MAX(Salary) - MIN(Salary) AS SalaryRange FROM Employees;"?
MAX(Salary)
MIN(Salary)
AS SalaryRange
All Correct
Q137
Q137 In "SELECT Name, LOG(Salary, 10) AS LogSalary FROM Employees WHERE Salary > 0;",
what needs correction?
LOG
Salary, 10
AS LogSalary
No error
Q138
Q138 What needs to be corrected in
"SELECT CONCAT(FirstName, ' ', LastName) FROM Employees;"?
All Correct
CONCAT
FirstName
LastName
Q139
Q139 Identify the error in
"SELECT SUBSTRING(Name, 1, 3) AS ShortName FROM Products;"
SUBSTRING
Name, 1, 3
AS ShortName
No error
Q140
Q140 Correct the syntax error in
"SELECT Name, CHARINDEX('a', Name) FROM Employees WHERE Name IS NOT NULL;"
CHARINDEX
'a', Name
FROM Employees
No syntax error
Q141
Q141 What is incorrect in
"SELECT UPPER(Name) FROM Employees;"?
UPPER
Name
FROM Employees
All Correct
Q142
Q142 In "SELECT Name, LTRIM(RTRIM(Name)) AS TrimmedName FROM Customers;",
what needs correction?
LTRIM
RTRIM
Name
No error
Q143
Q143 What is a correlated subquery in SQL?
A subquery that can be executed independently of the outer query
A subquery that uses values from the outer query
A subquery that returns multiple columns
A subquery used in the FROM clause
Q144
Q144 Identify the error in
"SELECT Name FROM Employees WHERE Salary > (SELECT AVG(Salary) FROM Employees);"
SELECT Name
WHERE Salary
(SELECT AVG(Salary) FROM Employees)
No error
Q145
Q145 What needs to be corrected in
"SELECT Name FROM Employees WHERE EXISTS (SELECT * FROM Departments WHERE Employees.DepartmentID = Departments.DepartmentID);"?
EXISTS clause
SELECT *
FROM Departments
No error
Q146
Q146 Correct the syntax error in
"SELECT Name, (SELECT MAX(Salary) FROM Employees) AS MaxSalary FROM Employees WHERE DepartmentID = (SELECT DepartmentID FROM Departments WHERE Name = 'HR');"
(SELECT MAX(Salary) FROM Employees)
AS MaxSalary
WHERE DepartmentID
No syntax error
Q147
Q147 What is a view in SQL?
A physical table stored in the database
A temporary table created during a session
A virtual table based on the result-set of an SQL statement
A duplicate copy of another table
Q148
Q148 What is a materialized view in SQL?
A view that is automatically updated when the underlying tables change
A view that is created for temporary use only
A view that is stored physically on the disk
A view that can be indexed
Q149
Q149 Identify the error in
"CREATE VIEW ActiveEmployees AS SELECT * FROM Employees WHERE Status = 'Active';"
CREATE VIEW
ActiveEmployees
SELECT * FROM Employees
No error
Q150
Q150 What needs to be corrected in
"CREATE OR REPLACE VIEW DepartmentSummary AS SELECT DepartmentID, COUNT(*) FROM Employees GROUP BY DepartmentID;"?
CREATE OR REPLACE VIEW
DepartmentSummary
SELECT DepartmentID, COUNT(*)
No error