
Q121
Q121 Identify the error in "SELECT Name, NULLIF(Age, 30) FROM Employees WHERE Age IS NOT NULL;"
Change 'NULLIF' to 'ISNULL'
Replace 'Age, 30' with 'Age, 0'
Remove 'WHERE Age IS NOT NULL'
No error
Q122
Q122 Correct the syntax error in "SELECT NVL(Salary, 'Not Provided') FROM Contractors;"
Change 'NVL' to 'COALESCE'
Replace 'Not Provided' with '0'
Add 'AS SalaryStatus' for clarity
No error
Q123
Q123 What is incorrect in "SELECT COALESCE(FirstName, LastName, 'Unknown') FROM Authors;"?
Replace 'COALESCE' with 'NVL'
Change 'Unknown' to 'NULL'
Add 'AS FullName' for clarity
No error
Q124
Q124 In "SELECT Name, NVL2(Salary, Salary * 1.1, Salary) AS NewSalary FROM Employees;", what needs correction?
Change 'NVL2' to 'COALESCE'
Replace 'Salary * 1.1' with 'Salary + 1000'
Remove 'AS NewSalary'
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;"?
Change 'CASE WHEN' to 'IF'
Replace '>= 18' with '> 18'
Remove 'ELSE 'Minor''
No error
Q127
Q127 Identify the error in "SELECT Name, CASE Gender WHEN 'M' THEN 'Male' WHEN 'F' THEN 'Female' END AS Gender FROM Employees;"
Change 'CASE Gender' to 'CASE WHEN Gender'
Replace 'END AS Gender' with 'END'
Add 'ELSE 'Other''
No error
Q128
Q128 What needs to be corrected in "SELECT CURRENT_DATE FROM Employees;"?
Replace 'CURRENT_DATE' with 'GETDATE()'
Remove 'FROM Employees'
Add 'AS Today'
No error
Q129
Q129 Identify the error in "SELECT Name, DATEDIFF(year, HireDate, GETDATE()) AS YearsWorked FROM Employees;"
Change 'DATEDIFF(year, HireDate, GETDATE())' to 'DATEDIFF(day, HireDate, GETDATE())'
Replace 'AS YearsWorked' with 'AS DaysWorked'
Remove 'GETDATE()'
No error
Q130
Q130 Correct the syntax error in "SELECT Name, DATEADD(MONTH, 6, HireDate) FROM Employees;"
Change 'DATEADD' to 'DATEDIFF'
Replace 'MONTH, 6' with 'YEAR, 1'
Remove 'HireDate'
No error
Q131
Q131 What is incorrect in "SELECT EXTRACT(MONTH FROM OrderDate) AS OrderMonth FROM Orders;"?
Replace 'EXTRACT' with 'DATEPART'
Change 'MONTH' to 'YEAR'
Remove 'AS OrderMonth'
No error
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;"?
Replace 'ABS' with 'MOD'
Change '-123' to '123'
Remove 'FROM Dual'
No error
Q134
Q134 Identify the error in "SELECT Name, CEILING(Salary) FROM Employees WHERE Salary > 0;"
Change 'CEILING' to 'FLOOR'
Replace 'Salary > 0' with 'Salary >= 0'
Add 'AS RoundedSalary' for clarity
No error
Q135
Q135 Correct the syntax error in "SELECT Name, ROUND(Salary, -2) FROM Employees;"
Change 'ROUND' to 'TRUNC'
Replace '-2' with '2'
Add 'AS RoundedSalary' for clarity
No error
Q136
Q136 What is incorrect in "SELECT MAX(Salary) - MIN(Salary) AS SalaryRange FROM Employees;"?
Replace 'MAX' with 'SUM'
Change '-' to '+'
Remove 'AS SalaryRange'
No error
Q137
Q137 In "SELECT Name, LOG(Salary, 10) AS LogSalary FROM Employees WHERE Salary > 0;", what needs correction?
Change 'LOG' to 'EXP'
Replace '10' with '2'
Remove 'WHERE Salary > 0'
No error
Q138
Q138 What needs to be corrected in "SELECT CONCAT(FirstName, ' ', LastName) FROM Employees;"?
Change 'CONCAT' to 'CONCATENATE'
Replace ',' with '+'
Add 'AS FullName' for clarity
No error
Q139
Q139 Identify the error in "SELECT SUBSTRING(Name, 1, 3) AS ShortName FROM Products;"
Change 'SUBSTRING' to 'LEFT'
Replace '1, 3' with '3'
Remove 'AS ShortName'
No error
Q140
Q140 Correct the syntax error in "SELECT Name, CHARINDEX('a', Name) FROM Employees WHERE Name IS NOT NULL;"
Change 'CHARINDEX' to 'INDEXOF'
Replace 'a' with '%a%'
Remove 'WHERE Name IS NOT NULL'
No error
Q141
Q141 What is incorrect in "SELECT UPPER(Name) FROM Employees;"?
Replace 'UPPER' with 'LOWER'
Change 'Name' to 'EmployeeName'
Add 'AS UppercaseName' for clarity
No error
Q142
Q142 In "SELECT Name, LTRIM(RTRIM(Name)) AS TrimmedName FROM Customers;", what needs correction?
Change 'LTRIM(RTRIM(Name))' to 'TRIM(Name)'
Remove 'AS TrimmedName'
Replace 'Name' with 'CustomerName'
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);"
Replace 'WHERE' with 'AND'
Change '>' to '<'
Add 'GROUP BY' after subquery
No error
Q145
Q145 What needs to be corrected in "SELECT Name FROM Employees WHERE EXISTS (SELECT * FROM Departments WHERE Employees.DepartmentID = Departments.DepartmentID);"?
Change 'WHERE EXISTS' to 'IF EXISTS'
Replace '*' with 'DepartmentID'
Add 'GROUP BY Name' at the end
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');"
Change the inner 'SELECT MAX(Salary)' to 'SUM(Salary)'
Remove 'AS MaxSalary'
Replace the second 'SELECT' with 'IN'
No 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';"
Change 'CREATE VIEW' to 'CREATE TABLE'
Replace '*' with specific column names
Remove 'WHERE Status = 'Active''
No error
Q150
Q150 What needs to be corrected in "CREATE OR REPLACE VIEW DepartmentSummary AS SELECT DepartmentID, COUNT(*) FROM Employees GROUP BY DepartmentID;"?
Change 'CREATE OR REPLACE VIEW' to 'CREATE VIEW'
Replace 'COUNT(*)' with 'COUNT(EmployeeID)'
Add 'ORDER BY DepartmentID' at the end
No error