Which SQL clause is used to sort query results in descending order?
Correct answer:
B) ORDER BY DESC
Explanation: The ORDER BY DESC clause sorts the query results in descending order by the specified column(s).
Which SQL clause is used to sort query results in descending order?
Correct answer:
B) ORDER BY DESC
Explanation: The ORDER BY DESC clause sorts the query results in descending order by the specified column(s).
In a relational database, which data type would be most suitable for storing a large textual document?
Correct answer:
C) TEXT
Explanation: The TEXT data type is suitable for storing large textual data in a relational database.
Which SQL keyword ensures that all values in a column are unique across all rows in a table?
Correct answer:
B) UNIQUE
Explanation: The UNIQUE keyword ensures that all values in a column are distinct, preventing duplicate entries in that column.
Which function in SQL returns the number of non-NULL rows in a result set?
Correct answer:
C) COUNT
Explanation: The COUNT function returns the number of non-NULL rows in a result set.
In SQL, which operator is used to check if a value exists in a specified set of values?
Correct answer:
B) IN
Explanation: The IN operator checks if a value exists in a list of specified values.
Which type of key allows NULL values and is used to create links between tables?
Correct answer:
A) Foreign Key
Explanation: A Foreign Key allows NULL values and is used to establish relationships between tables by referencing the primary key in another table.
Which SQL keyword removes duplicate rows from the result of a SELECT statement?
Correct answer:
B) DISTINCT
Explanation: The DISTINCT keyword removes duplicate rows from the result of a SELECT query, returning only unique rows.
Which SQL function is used to convert all characters in a string to uppercase?
Correct answer:
A) UPPER
Explanation: The UPPER function converts all characters in a string to uppercase in SQL.
Which type of index is optimized for queries that check whether values fall within a range?
Correct answer:
C) B-Tree Index
Explanation: B-Tree indexes are optimized for queries that involve range-based searches, as they allow efficient traversal through ordered data.
In a database, which term describes the combination of multiple columns to form a single key that uniquely identifies each row?
Correct answer:
A) Composite Key
Explanation: A Composite Key is a combination of two or more columns that together uniquely identify each row in a table.
Which aggregate function in SQL is used to return the highest value in a column?
Correct answer:
A) MAX
Explanation: The MAX function returns the highest value from a specified column in SQL.
Which SQL clause groups rows that have the same values in specified columns?
Correct answer:
A) GROUP BY
Explanation: The GROUP BY clause groups rows that share the same values in the specified columns, often used with aggregate functions.
Which SQL command is used to create a new user account with specific privileges?
Correct answer:
B) CREATE USER
Explanation: The CREATE USER command is used to create a new database user account, which can then be granted specific privileges.
Which clause is used in SQL to return only unique values from a column?
Correct answer:
B) DISTINCT
Explanation: The DISTINCT clause ensures that only unique values are returned from the specified column, removing duplicates.
Which SQL clause is used to combine the results of two SELECT statements?
Correct answer:
A) UNION
Explanation: The UNION clause is used to combine the results of two SELECT queries into a single result set, excluding duplicates.
Which SQL keyword is used to limit the number of rows returned by a query?
Correct answer:
A) LIMIT
Explanation: The LIMIT keyword restricts the number of rows returned by a SELECT query to a specified number.
Which type of constraint ensures that the values in a column must satisfy a specified condition?
Correct answer:
C) CHECK
Explanation: The CHECK constraint ensures that the values in a column meet a specified condition or rule.
Which type of database relationship is created when a table contains a reference to itself?
Correct answer:
D) Self-Join
Explanation: A Self-Join occurs when a table is joined to itself, often used to compare rows within the same table.
Which clause in SQL is used to apply a filter to grouped data?
Correct answer:
B) HAVING
Explanation: The HAVING clause is used to apply conditions to groups created by the GROUP BY clause, filtering the results after grouping.
What is the purpose of an index in a relational database?
Correct answer:
C) To speed up data retrieval
Explanation: Indexes are used to improve the performance of queries by allowing the database to locate and retrieve rows more quickly.
Which SQL function is used to count the number of non-NULL values in a column?
Correct answer:
B) COUNT
Explanation: The COUNT function returns the number of non-NULL values in a specified column.
Which clause is used to specify the conditions for updating rows in a table?
Correct answer:
A) WHERE
Explanation: The WHERE clause is used to specify the conditions that must be met for a row to be updated in a table.
In SQL, what is the primary purpose of the SELECT statement?
Correct answer:
B) To retrieve data from a table
Explanation: The SELECT statement is used to retrieve data from one or more tables in a database.
Which SQL clause is used to specify the table from which data is being retrieved?
Correct answer:
B) FROM
Explanation: The FROM clause specifies the table(s) from which the data is being retrieved in a SQL query.
Which SQL operator is used to combine two conditions that must both be true?
Correct answer:
B) AND
Explanation: The AND operator is used to combine two or more conditions in a SQL query, where all conditions must be true for the result to be returned.
Which SQL keyword is used to assign an alias to a column in a SELECT query?
Correct answer:
B) AS
Explanation: The AS keyword is used to assign an alias to a column or table, allowing for more readable result sets.
In SQL, which function removes leading and trailing spaces from a string?
Correct answer:
A) TRIM
Explanation: The TRIM function removes leading and trailing spaces from a string in SQL.
Which type of key is made up of two or more columns that together uniquely identify a row?
Correct answer:
B) Composite Key
Explanation: A Composite Key consists of two or more columns that together uniquely identify each row in a table.
Which clause in SQL is used to filter results before grouping them in a GROUP BY query?
Correct answer:
B) WHERE
Explanation: The WHERE clause filters rows before they are grouped in a GROUP BY query, applying conditions to individual rows.
Which SQL command is used to permanently delete a table, including all its data and structure?
Correct answer:
A) DROP TABLE
Explanation: The DROP TABLE command is used to delete a table and all its data and structure permanently from the database.
Which SQL keyword is used to add a new row to a table?
Correct answer:
B) INSERT
Explanation: The INSERT command adds a new row to a table, specifying the values to be added for each column.
Which type of join in SQL returns all rows from both tables, filling in NULLs where there are no matches?
Correct answer:
B) FULL JOIN
Explanation: A FULL JOIN returns all rows from both the left and right tables, filling in NULL values where there is no match.
Which SQL function returns the absolute value of a number?
Correct answer:
A) ABS
Explanation: The ABS function returns the absolute (positive) value of a given number in SQL.
What is the primary purpose of the CREATE INDEX command in SQL?
Correct answer:
C) To speed up query performance
Explanation: The CREATE INDEX command is used to create an index on one or more columns of a table to improve query performance.
Which SQL function is used to return the current system date and time?
Correct answer:
B) NOW
Explanation: The NOW function returns the current date and time based on the system's clock in SQL.
In SQL, which command is used to change the structure of an existing table?
Correct answer:
C) ALTER TABLE
Explanation: The ALTER TABLE command is used to modify the structure of an existing table, such as adding or dropping columns.
Which SQL operator is used to match a pattern in a string using wildcards?
Correct answer:
A) LIKE
Explanation: The LIKE operator is used to match patterns in strings using wildcard characters, such as % and.
Which type of database constraint ensures that a value is unique across all rows in a table?
Correct answer:
C) UNIQUE
Explanation: The UNIQUE constraint ensures that values in a column or set of columns are unique across all rows in a table.
Which SQL keyword is used to retrieve data from a table?
Correct answer:
C) SELECT
Explanation: The SELECT keyword is used to retrieve data from one or more tables in a database.
Which SQL clause is used to sort rows in ascending order by default?
Correct answer:
A) ORDER BY
Explanation: The ORDER BY clause sorts rows in ascending order by default, unless the DESC keyword is used to specify descending order.
Which SQL function returns the total number of rows in a result set?
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.
Which type of join in SQL combines all rows from two tables, regardless of matching values?
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.
Which SQL keyword is used to filter the results of a query based on a condition?
Correct answer:
A) WHERE
Explanation: The WHERE clause filters the rows returned by a query based on a specified condition.
Which SQL command is used to remove all rows from a table but keep its structure intact?
Correct answer:
B) TRUNCATE
Explanation: The TRUNCATE command removes all rows from a table but retains the table structure for future use.
Which SQL function is used to return the length of a string?
Correct answer:
A) LENGTH
Explanation: The LENGTH function returns the number of characters in a string in SQL.
Which SQL operator is used to return values that do not match a specified pattern?
Correct answer:
A) NOT LIKE
Explanation: The NOT LIKE operator returns values that do not match a specified pattern in SQL.
Which SQL keyword is used to remove duplicate rows from the result set of a query?
Correct answer:
A) DISTINCT
Explanation: The DISTINCT keyword removes duplicate rows from the result set of a query, returning only unique rows.
Which SQL function is used to extract a substring from a string?
Correct answer:
A) SUBSTRING
Explanation: The SUBSTRING function extracts a portion of a string based on specified starting and ending positions.
In SQL, which keyword is used to change the values in a table based on a condition?
Correct answer:
A) UPDATE
Explanation: The UPDATE command changes the values in an existing row based on the condition specified in the WHERE clause.
Which SQL function returns the current date without the time portion?
Correct answer:
A) CURDATE
Explanation: The CURDATE function returns the current date without including the time portion in SQL.
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.