Which SQL operator is used to compare two values for inequality?
Correct answer:
C) <>
Explanation: The <> operator is used to compare two values for inequality in SQL. Some databases also use != for this purpose.
Which SQL operator is used to compare two values for inequality?
Correct answer:
C) <>
Explanation: The <> operator is used to compare two values for inequality in SQL. Some databases also use != for this purpose.
What does the SQL MIN() function do?
Correct answer:
A) Returns the minimum value in a column
Explanation: The MIN() function returns the smallest value in a column.
Which SQL keyword is used to specify a condition that is applied to individual rows before they are grouped?
Correct answer:
A) WHERE
Explanation: The WHERE clause is used to specify a condition that is applied to individual rows before they are grouped.
Which SQL clause is used to limit the number of rows returned by a query?
Correct answer:
B) LIMIT
Explanation: The LIMIT clause is used to limit the number of rows returned by a query.
How do you remove duplicate rows from a result set in SQL?
Correct answer:
C) DISTINCT
Explanation: The DISTINCT keyword is used to remove duplicate rows from a result set.
What SQL statement would you use to remove a table from a database?
Correct answer:
B) DROP TABLE
Explanation: The DROP TABLE statement is used to remove a table and its data from the database.
Which SQL function returns the largest value in a numeric column?
Correct answer:
B) MAX()
Explanation: The MAX() function returns the largest value in a numeric column.
How do you select rows where a column value is NULL in SQL?
Correct answer:
C) WHERE column IS NULL
Explanation: To select rows where a column contains NULL, use WHERE column IS NULL.
Which SQL statement is used to modify 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, such as adding or removing columns.
What does the SQL function COUNT() do?
Correct answer:
A) Returns the number of rows in a result set
Explanation: The COUNT() function returns the number of rows in a query result.
What SQL function would you use to convert a string to uppercase?
Correct answer:
B) UPPER()
Explanation: The UPPER() function converts a string to uppercase in SQL.
How do you return all rows from a table in SQL?
Correct answer:
B) SELECT *
Explanation: The SELECT * statement returns all rows and columns from a table.
Which SQL keyword is used to combine the results of two or more queries into a single result set?
Correct answer:
B) UNION
Explanation: The UNION operator combines the results of two or more queries into a single result set, removing duplicates.
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.
How do you select only the first 10 rows from a table in SQL?
Correct answer:
A) LIMIT 10
Explanation: The LIMIT clause is used to limit the number of rows returned by a query.
Which SQL function would you use to return the current system date and time?
Correct answer:
C) CURRENT_TIMESTAMP()
Explanation: The CURRENT_TIMESTAMP() function returns the current system date and time.
What does the SQL HAVING clause do?
Correct answer:
B) It filters groups after they are formed
Explanation: The HAVING clause is used to filter groups created by the GROUP BY clause.
Which SQL operator is used to match a value with any value in a list of values?
Correct answer:
A) IN
Explanation: The IN operator is used to match a value with any value in a list.
Which SQL keyword is used to create a new database?
Correct answer:
A) CREATE DATABASE
Explanation: The CREATE DATABASE statement is used to create a new database in SQL.
How do you retrieve only unique values from a column in SQL?
Correct answer:
A) DISTINCT
Explanation: The DISTINCT keyword returns only unique values in the query result.
What SQL statement is used to add a new column to an existing table?
Correct answer:
A) ALTER TABLE ADD COLUMN
Explanation: The ALTER TABLE ADD COLUMN statement is used to add a new column to an existing table.
Which SQL function would you use to count the number of distinct values in a column?
Correct answer:
C) COUNT(DISTINCT)
Explanation: The COUNT(DISTINCT) function counts the number of distinct values in a column.
Which SQL function is used to concatenate two or more strings?
Correct answer:
A) CONCAT()
Explanation: The CONCAT() function is used to concatenate two or more strings into a single string.
Which SQL clause is used to filter records after they have been grouped?
Correct answer:
B) HAVING
Explanation: The HAVING clause is used to filter records after they have been grouped by the GROUP BY clause.
How do you calculate the total sum of a numeric column in SQL?
Correct answer:
A) SUM()
Explanation: The SUM() function is used to calculate the total sum of a numeric column.
Which SQL keyword is used to ensure that a column cannot contain duplicate values?
Correct answer:
C) UNIQUE
Explanation: The UNIQUE constraint ensures that all values in a column are distinct.
Which SQL keyword is used to rename a column in a table?
Correct answer:
B) RENAME COLUMN
Explanation: The RENAME COLUMN statement is used to rename a column in a table.
What is the result of the SQL expression SELECT 5 + 3?
Correct answer:
A) 8
Explanation: The + operator adds two numbers together, so 5 + 3 equals 8.
Which SQL function is used to extract a portion of a string?
Correct answer:
A) SUBSTRING()
Explanation: The SUBSTRING() function is used to extract a portion of a string based on a starting position and length.
Which SQL function returns 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 clause ORDER BY do?
Correct answer:
A) Sorts rows in the result set
Explanation: The ORDER BY clause is used to sort rows in ascending or descending order.
Which SQL keyword is used to specify a condition that must be true 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 current time?
Correct answer:
A) CURRENT_TIME()
Explanation: The CURRENT_TIME() function returns the current system time.
How do you delete rows from a table in SQL?
Correct answer:
A) DELETE FROM
Explanation: The DELETE FROM statement is used to remove rows from a table based on a specified condition.
What SQL clause would you use to filter rows based on a condition?
Correct answer:
A) WHERE
Explanation: The WHERE clause is used to filter rows based on a specified condition.
Which SQL function would you use to calculate the average value of a numeric column?
Correct answer:
B) AVG()
Explanation: The AVG() function calculates the average value of a numeric column.
Which SQL clause is used to combine rows from two or more tables?
Correct answer:
A) JOIN
Explanation: The JOIN clause is used to combine rows from two or more tables based on a related column.
What does the SQL operator BETWEEN do?
Correct answer:
A) Filters rows within a range of values
Explanation: The BETWEEN operator is used to filter rows where a column value is within a specified range.
What SQL keyword is used to remove all rows from a table without removing the table itself?
Correct answer:
B) TRUNCATE
Explanation: The TRUNCATE statement removes all rows from a table but leaves the table structure intact.
What is the purpose of the SQL function LENGTH()?
Correct answer:
A) Returns the length of a string
Explanation: The LENGTH() function returns the number of characters in a string.
Which SQL clause is used to group rows that have the same values in specified columns?
Correct answer:
A) GROUP BY
Explanation: The GROUP BY clause is used to group rows that have the same values in one or more columns.
How do you modify the value of an existing column in SQL?
Correct answer:
B) UPDATE
Explanation: The UPDATE statement is used to modify the value of an existing column in SQL.
Which SQL keyword is used to combine rows from two queries into one result set and includes duplicates?
Correct answer:
A) UNION ALL
Explanation: The UNION ALL operator combines rows from two queries into one result set and includes duplicates.
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.
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.