Which SQL clause is used to filter records returned by a SELECT statement after the records are grouped?
Correct answer:
C) HAVING
Explanation: The HAVING clause is used to filter records after they have been grouped by the GROUP BY clause.
Which SQL clause is used to filter records returned by a SELECT statement after the records are grouped?
Correct answer:
C) HAVING
Explanation: The HAVING clause is used to filter records after they have been grouped by the GROUP BY clause.
What SQL function would you use to calculate the average of a column of numbers?
Correct answer:
C) AVG()
Explanation: The AVG() function is used to calculate the average value of a numeric column.
Which SQL operator is used to return rows that match a pattern?
Correct answer:
B) LIKE
Explanation: The LIKE operator is used to return rows that match a specified pattern.
How do you update the value of a specific row in SQL?
Correct answer:
B) UPDATE
Explanation: The UPDATE statement is used to modify the value of a specific row in SQL.
Which SQL function returns the largest value in a numeric column?
Correct answer:
A) MAX()
Explanation: The MAX() function returns the largest value in a selected column.
How do you select rows that have a NULL value in a specific column?
Correct answer:
A) WHERE column IS NULL
Explanation: The correct way to select rows that contain NULL values is to use WHERE column IS NULL.
What SQL statement would you use to create a new table?
Correct answer:
B) CREATE TABLE
Explanation: The CREATE TABLE statement is used to create a new table in SQL.
Which SQL operator is used to combine multiple conditions in a WHERE clause where both conditions must be true?
Correct answer:
B) AND
Explanation: The AND operator is used to combine multiple conditions where both must be true for a row to be selected.
Which SQL function would you use to count the number of non-NULL values in a column?
Correct answer:
A) COUNT()
Explanation: The COUNT() function returns the number of non-NULL values in a selected column.
What does the SQL function LOWER() do?
Correct answer:
B) Converts a string to lowercase
Explanation: The LOWER() function converts a string to lowercase.
Which SQL keyword is used to eliminate duplicate rows in a result set?
Correct answer:
A) DISTINCT
Explanation: The DISTINCT keyword is used to return only unique rows in a query result.
How do you retrieve all columns from a table in SQL?
Correct answer:
B) SELECT *
Explanation: The SELECT * statement selects all columns from a table.
What is the purpose of the SQL GROUP BY clause?
Correct answer:
B) To group rows that have the same values into summary rows
Explanation: The GROUP BY clause is used to group rows with the same values into summary rows.
What does the SQL keyword ASC stand for?
Correct answer:
A) Ascending
Explanation: ASC is short for ascending, and it is used to sort the result set in ascending order.
Which SQL keyword is used to remove all rows from a table but retain the table's structure?
Correct answer:
B) TRUNCATE
Explanation: The TRUNCATE statement removes all rows from a table but retains the table's structure.
How do you retrieve only the first 5 rows from a query result in SQL?
Correct answer:
A) LIMIT 5
Explanation: The LIMIT clause is used to restrict the number of rows returned by a query.
Which SQL clause is used to filter records before they are grouped?
Correct answer:
A) WHERE
Explanation: The WHERE clause filters records before they are grouped by the GROUP BY clause.
What is the purpose of the SQL COUNT() function?
Correct answer:
B) To return the number of rows in a result set
Explanation: The COUNT() function returns the number of rows in a query result.
How do you retrieve rows where a column value falls within a range of two values in SQL?
Correct answer:
A) WHERE column BETWEEN value1 AND value2
Explanation: The BETWEEN operator selects rows where the column value falls within a specified range.
Which SQL statement is used to delete a specific row from a table?
Correct answer:
A) DELETE
Explanation: The DELETE statement removes specific rows from a table based on a condition.
Which SQL keyword is used to ensure that a column cannot contain NULL values?
Correct answer:
A) NOT NULL
Explanation: The NOT NULL constraint ensures that a column cannot have NULL values.
Which SQL keyword is used to ensure that all values in a column are unique?
Correct answer:
A) UNIQUE
Explanation: The UNIQUE constraint ensures that all values in a column are distinct.
How do you rename an existing table in SQL?
Correct answer:
A) RENAME TABLE
Explanation: The RENAME TABLE statement is used to rename an existing table.
What is the result of the SQL expression: SELECT 15 % 4?
Correct answer:
A) 3
Explanation: The modulo operator (%) returns the remainder of the division of 15 by 4, which is 3.
Which SQL function is used to return the absolute value of a number?
Correct answer:
A) ABS()
Explanation: The ABS() function returns the absolute value of a number.
Which SQL clause is used to sort the result set?
Correct answer:
A) ORDER BY
Explanation: The ORDER BY clause is used to sort the result set in either ascending or descending order.
What SQL function would you use to return the smallest integer greater than or equal to a given number?
Correct answer:
A) CEILING()
Explanation: The CEILING() function returns the smallest integer greater than or equal to the given number.
How do you select rows where a column value does not match a specified pattern in SQL?
Correct answer:
A) WHERE column NOT LIKE pattern
Explanation: The NOT LIKE operator is used to return rows that do not match a specified pattern.
Which SQL function is used to round a number to a specified number of decimal places?
Correct answer:
A) ROUND()
Explanation: The ROUND() function rounds a number to a specified number of decimal places.
What is the purpose of the SQL NVL() function?
Correct answer:
A) It replaces NULL values with a specified value
Explanation: The NVL() function replaces NULL values with a specified value.
Which SQL clause is used to join two or more tables based on a related column?
Correct answer:
A) JOIN
Explanation: The JOIN clause is used to combine rows from two or more tables based on a related column.
Which SQL keyword is used to specify a condition that must be met for a row to be included in the result set?
Correct answer:
A) WHERE
Explanation: The WHERE clause is used to filter rows based on a specified condition.
What SQL function would you use to return the length of a string?
Correct answer:
A) LENGTH()
Explanation: The LENGTH() function returns the number of characters in a string.
What does the SQL HAVING clause do?
Correct answer:
A) It filters groups after they have been formed
Explanation: The HAVING clause is used to filter groups after the GROUP BY clause has been applied.
Which SQL keyword is used to select only rows where a column contains a specific value?
Correct answer:
D) WHERE
Explanation: The WHERE clause is used to select rows based on a specified condition.
What SQL function would you use to return the current date?
Correct answer:
C) CURRENT_DATE()
Explanation: The CURRENT_DATE() function returns the current date.
Which SQL statement is used to change the structure of an existing table?
Correct answer:
A) ALTER TABLE
Explanation: The ALTER TABLE statement is used to modify the structure of an existing table.
What SQL clause would you use to remove duplicate rows from a result set?
Correct answer:
A) DISTINCT
Explanation: The DISTINCT keyword removes duplicate rows from the result set.
Which SQL function is used to calculate the sum of a numeric column?
Correct answer:
B) SUM()
Explanation: The SUM() function calculates the total sum of a numeric column.
How do you remove a table from a database in SQL?
Correct answer:
A) DROP TABLE
Explanation: The DROP TABLE statement removes a table and its data from the database.
Which SQL function is used to return the current time?
Correct answer:
A) CURRENT_TIME()
Explanation: The CURRENT_TIME() function returns the current system time.
How do you combine the results of two SQL queries into one result set?
Correct answer:
A) UNION
Explanation: The UNION operator combines the results of two SQL queries into one result set.
What does the SQL keyword ASC do?
Correct answer:
A) Sorts rows in ascending order
Explanation: The ASC keyword sorts the result set in ascending order.
Which SQL clause is used to specify a condition for combining two tables?
Correct answer:
A) ON
Explanation: The ON keyword is used to specify the condition for combining two tables.
Which SQL function is used to return the current date and time?
Correct answer:
A) NOW()
Explanation: The NOW() function returns the current date and time.
What does the SQL clause LIMIT do?
Correct answer:
A) Limits the number of rows returned by a query
Explanation: The LIMIT clause is used to restrict the number of rows returned by a query.
How do you modify the data type of an existing column in SQL?
Correct answer:
A) ALTER TABLE MODIFY COLUMN
Explanation: The ALTER TABLE MODIFY COLUMN statement is used to change the data type of an existing column.
Which SQL clause is used to group rows that have the same values into summary rows?
Correct answer:
A) GROUP BY
Explanation: The GROUP BY clause is used to group rows that have the same values into summary rows.
How do you rename a column in SQL?
Correct answer:
A) ALTER TABLE RENAME COLUMN
Explanation: The ALTER TABLE RENAME COLUMN statement is used to rename a column in SQL.
What is the purpose of the SQL clause WHERE?
Correct answer:
A) It filters rows based on a specified condition
Explanation: The WHERE clause is used to filter rows that meet a specific condition.
If this exam is giving you a hard time, let us be your helping hand. Contact us, and we'll provide the assistance you need to pass and move forward.