PostgresSQL Server
PostgresSQL Server
a) MIN()
b) AVG()
c) MAX()
d) SUM()
Answer: c) MAX()
Answer: b) A column or combination of columns that uniquely identifies each row in a table
Which SQL command is used to make permanent changes to the database?
a) COMMIT
b) ROLLBACK
c) SAVEPOINT
d) APPLY
Answer: a) COMMIT
Which SQL JOIN type returns all rows from both tables and fills in NULL values for non-matching
rows?
a) INNER JOIN
a) UPDATE
b) INSERT
c) MODIFY
d) SET
Answer: a) UPDATE
a) DELETE
b) TRUNCATE
c) DROP
d) REMOVE
Answer: a) DELETE
a) MIN()
b) MAX()
c) AVG()
d) SUM()
Answer: c) AVG()
d) To perform conditional logic and return different values based on specified conditions
Answer: d) To perform conditional logic and return different values based on specified conditions
a) CREATE TABLE
b) INSERT INTO
c) ALTER TABLE
d) MAKE TABLE
a) SELECT INTO
b) JOIN
c) GROUP BY
d) UNION
Answer: b) JOIN
What is the purpose of the SQL ORDER BY clause?
a) ADD COLUMN
b) ALTER TABLE
c) CREATE COLUMN
d) INSERT COLUMN
a) DROP
b) DELETE
c) REMOVE
d) ERASE
Answer: a) DROP
Which SQL query is used to update data in a table with values from another table?
a) REPLACE
b) INSERT INTO
c) UPDATE JOIN
d) UPDATE SET
Which SQL query is used to combine the results of two or more SELECT queries and remove
duplicates?
a) INTERSECT
b) UNION
c) JOIN
d) MERGE
Answer: b) UNION
Which SQL query is used to find the nth highest salary in a table?
c) SELECT MAX(Salary) FROM Employees WHERE Salary NOT IN (SELECT MAX(Salary) FROM
Employees);
Answer: d) SELECT Salary FROM Employees ORDER BY Salary DESC LIMIT N-1,1;
Which SQL query is used to find employees who have the same salary as the highest-paid employee?
Answer: b) SELECT * FROM Employees WHERE Salary = (SELECT MAX(Salary) FROM Employees);
a) SELECT * FROM Employees e WHERE e.JoinDate < (SELECT JoinDate FROM Employees WHERE
ManagerID = e.ManagerID);
c) SELECT * FROM Employees WHERE JoinDate < ALL (SELECT JoinDate FROM Employees WHERE
ManagerID = e.ManagerID);
d) SELECT * FROM Employees e WHERE e.JoinDate < ANY (SELECT JoinDate FROM Employees WHERE
ManagerID = e.ManagerID);
Answer: a) SELECT * FROM Employees e WHERE e.JoinDate < (SELECT JoinDate FROM Employees
WHERE ManagerID = e.ManagerID);
d) To join two or more tables and return only the matching rows.
Which SQL query is used to find the most recent record for each employee in the "Logs" table?
d) SELECT * FROM Logs WHERE LogDate = (SELECT MAX(LogDate) FROM Logs WHERE EmployeeID =
Logs.EmployeeID);
Answer: a) SELECT DISTINCT ON (EmployeeID) * FROM Logs ORDER BY EmployeeID, LogDate DESC;
a) To return the next row relative to the current row within a result set.
c) To find the difference between the current row and the next row in a result set.
Answer: a) To return the next row relative to the current row within a result set.
Which SQL query is used to find the number of occurrences of each value in a column?
a) SELECT
b) UPDATE
c) DELETE
d) INSERT
Answer: a) SELECT
a) ORDER BY
b) GROUP BY
c) WHERE
d) HAVING
Answer: c) WHERE
Which SQL statement is used to insert new data into a database table?
a) UPDATE
b) INSERT
c) MODIFY
d) ADD
Answer: b) INSERT