Q271
Q271 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
Q272
Q272 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
Q273
Q273 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
Q274
Q274 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
Q275
Q275 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
Q276
Q276 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
Q277
Q277 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
Q278
Q278 What needs to be corrected in "SELECT CURRENT_DATE FROM Employees;"?
Replace 'CURRENT_DATE' with 'GETDATE()'
Remove 'FROM Employees'
Add 'AS Today'
No error
Q279
Q279 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
Q280
Q280 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
Q281
Q281 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
Q282
Q282 In "SELECT Name, AGE(BirthDate) AS Age FROM Customers;",
what needs correction?
AGE
BirthDate
AS Age
No error
Q283
Q283 What needs to be corrected in "SELECT ABS(-123) FROM Dual;"?
Replace 'ABS' with 'MOD'
Change '-123' to '123'
Remove 'FROM Dual'
No error
Q284
Q284 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
Q285
Q285 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
Q286
Q286 What is incorrect in "SELECT MAX(Salary) - MIN(Salary) AS SalaryRange FROM Employees;"?
Replace 'MAX' with 'SUM'
Change '-' to '+'
Remove 'AS SalaryRange'
No error
Q287
Q287 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
Q288
Q288 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
Q289
Q289 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
Q290
Q290 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
Q291
Q291 What is incorrect in "SELECT UPPER(Name) FROM Employees;"?
Replace 'UPPER' with 'LOWER'
Change 'Name' to 'EmployeeName'
Add 'AS UppercaseName' for clarity
No error
Q292
Q292 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
Q293
Q293 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
Q294
Q294 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
Q295
Q295 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
Q296
Q296 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
Q297
Q297 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
Q298
Q298 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
Q299
Q299 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
Q300
Q300 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