-
web.groovymark@gmail.com
- October 25, 2024
Question 41
Which SQL function returns the total number of rows in a result set?
a) COUNT()
b) SUM()
c) AVG()
d) MAX()
Correct Answer: a) COUNT()
Explanation: The COUNT() function returns the total number of rows in a result set, often used to count rows that meet certain conditions.
Question 42
Which type of join in SQL combines all rows from two tables, regardless of matching values?
a) FULL JOIN
b) CROSS JOIN
c) INNER JOIN
d) LEFT JOIN
Correct Answer: b) CROSS JOIN
Explanation: A CROSS JOIN returns the Cartesian product of two tables, combining all rows from both tables, regardless of matching values.
Question 43
Which SQL keyword is used to filter the results of a query based on a condition?
a) WHERE
b) HAVING
c) LIMIT
d) ORDER BY
Correct Answer: a) WHERE
Explanation: The WHERE clause filters the rows returned by a query based on a specified condition.
Question 44
Which SQL command is used to remove all rows from a table but keep its structure intact?
a) DELETE
b) TRUNCATE
c) DROP TABLE
d) REMOVE TABLE
Correct Answer: b) TRUNCATE
Explanation: The TRUNCATE command removes all rows from a table but retains the table structure for future use.
Question 45
Which SQL function is used to return the length of a string?
a) LENGTH()
b) CONCAT()
c) TRIM()
d) SUBSTRING()
Correct Answer: a) LENGTH()
Explanation: The LENGTH() function returns the number of characters in a string in SQL.
Question 46
Which SQL operator is used to return values that do not match a specified pattern?
a) NOT LIKE
b) LIKE
c) NOT IN
d) EXISTS
Correct Answer: a) NOT LIKE
Explanation: The NOT LIKE operator returns values that do not match a specified pattern in SQL.
Question 47
Which SQL keyword is used to remove duplicate rows from the result set of a query?
a) DISTINCT
b) GROUP BY
c) ORDER BY
d) HAVING
Correct Answer: a) DISTINCT
Explanation: The DISTINCT keyword removes duplicate rows from the result set of a query, returning only unique rows.
Question 48
Which SQL function is used to extract a substring from a string?
a) SUBSTRING()
b) CONCAT()
c) LENGTH()
d) TRIM()
Correct Answer: a) SUBSTRING()
Explanation: The SUBSTRING() function extracts a portion of a string based on specified starting and ending positions.
Question 49
In SQL, which keyword is used to change the values in a table based on a condition?
a) UPDATE
b) DELETE
c) INSERT
d) SELECT
Correct Answer: a) UPDATE
Explanation: The UPDATE command changes the values in an existing row based on the condition specified in the WHERE clause.
Question 50
Which SQL function returns the current date without the time portion?
a) CURDATE()
b) NOW()
c) GETDATE()
d) DATE()
Correct Answer: a) CURDATE()
Explanation: The CURDATE() function returns the current date without including the time portion in SQL.