-
web.groovymark@gmail.com
- October 28, 2024
Question 41
Which SQL function is used to find the highest value in a column?
a) MIN()
b) MAX()
c) SUM()
d) AVERAGE()
Correct Answer: b) MAX()
Explanation: The MAX() function retrieves the highest value from a specified column in SQL.
Question 42
Which SQL clause is used to group rows that have the same values in specified columns?
a) ORDER BY
b) GROUP BY
c) HAVING
d) WHERE
Correct Answer: b) GROUP BY
Explanation: The GROUP BY clause groups rows that share the same values in the specified columns, often used with aggregate functions.
Question 43
Which SQL command is used to remove duplicates from a result set?
a) DISTINCT
b) UNIQUE
c) GROUP BY
d) HAVING
Correct Answer: a) DISTINCT
Explanation: The DISTINCT keyword is used to return only unique records from the result set, eliminating duplicates.
Question 44
Which SQL function would you use to count the number of non-NULL entries in a column?
a) TOTAL()
b) COUNT()
c) SUM()
d) LENGTH()
Correct Answer: b) COUNT()
Explanation: The COUNT() function counts the number of non-NULL entries in a specified column.
Question 45
Which clause is used to specify the order of the result set in SQL?
a) SORT BY
b) ORDER BY
c) GROUP BY
d) ARRANGE BY
Correct Answer: b) ORDER BY
Explanation: The ORDER BY clause is used to sort the result set in ascending or descending order based on one or more columns.
Question 46
Which SQL command is used to remove a user from a database?
a) DELETE USER
b) REMOVE USER
c) DROP USER
d) DISABLE USER
Correct Answer: c) DROP USER
Explanation: The DROP USER command is used to permanently remove a user from the database management system.
Question 47
Which SQL function is used to replace a substring with another string?
a) SUBSTITUTE()
b) REPLACE()
c) CHANGE()
d) TRANSFORM()
Correct Answer: b) REPLACE()
Explanation: The REPLACE() function is used to substitute occurrences of a specified substring with a new string in SQL.
Question 48
Which SQL keyword is used to specify the criteria for data retrieval in a SELECT statement?
a) CONDITION
b) WHERE
c) HAVING
d) FILTER
Correct Answer: b) WHERE
Explanation: The WHERE clause is used to specify the criteria that must be met for records to be included in the result set of a SELECT statement.
Question 49
What is a subquery in SQL?
a) A query that modifies data
b) A query nested inside another query
c) A command that creates a new table
d) A function that summarizes data
Correct Answer: b) A query nested inside another query
Explanation: A subquery is a query embedded within another SQL query, often used to provide data for the outer query.
Question 50
Which SQL function is used to extract a portion of a string?
a) SUBSTRING()
b) SPLIT()
c) TRIM()
d) CONCAT()
Correct Answer: a) SUBSTRING()
Explanation: The SUBSTRING() function extracts a specific portion of a string based on the starting position and length specified.