Question 1 of 50
What SQL statement is used to retrieve all columns from a table named "Employees"?
Correct answer:
C) SELECT * FROM Employees
Explanation: The SELECT * FROM Employees statement retrieves all the columns from the table. The * is a wildcard that represents all columns.
Question 2 of 50
Which SQL statement is used to insert a new row into a table named "Orders"?
Correct answer:
A) INSERT INTO Orders
Explanation: The INSERT INTO Orders statement is used to insert a new row of data into the "Orders" table.
Question 3 of 50
What SQL function is used to count the number of rows in a table?
Correct answer:
B) COUNT(*)
Explanation: The COUNT(*) function is used to count the total number of rows in a table.
Question 4 of 50
Which SQL clause is used to filter records in a SELECT statement?
Correct answer:
C) WHERE
Explanation: The WHERE clause is used to filter records based on specified conditions in a SELECT statement.
Question 5 of 50
Which SQL operator is used to combine two or more conditions?
Correct answer:
B) AND
Explanation: The AND operator is used to combine two or more conditions, where all must be true for the result to be true.
Question 6 of 50
What does the SQL keyword DISTINCT do in a query?
Correct answer:
B) Selects unique values
Explanation: The DISTINCT keyword is used to select unique values from a column, removing any duplicates.
Question 7 of 50
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 groups rows that have the same values into summary rows, like "count," "sum," etc.
Question 8 of 50
Which SQL statement is used to remove rows from a table?
Correct answer:
B) DELETE
Explanation: The DELETE statement is used to remove rows from a table based on a condition.
Question 9 of 50
Which SQL statement is used to modify existing data in a table?
Correct answer:
C) UPDATE
Explanation: The UPDATE statement is used to modify existing records in a table.
Question 10 of 50
What keyword is used in SQL to sort the result-set of a query?
Correct answer:
B) ORDER BY
Explanation: The ORDER BY keyword is used to sort the result-set in either ascending or descending order.
Question 11 of 50
How do you select all records where the column "City" has the value 'Berlin'?
Correct answer:
A) SELECT * FROM Customers WHERE City = 'Berlin'
Explanation: The correct SQL query uses the WHERE clause to filter rows where the City column has the value 'Berlin'.
Question 12 of 50
Which SQL keyword is used to remove a table from a database?
Correct answer:
C) DROP TABLE
Explanation: The DROP TABLE statement is used to completely remove a table and its data from the database.
Question 13 of 50
Which function is used to find the largest value in a column?
Correct answer:
B) MAX()
Explanation: The MAX() function is used to return the largest value from a selected column.
Question 14 of 50
Which function is used to find the smallest value in a column?
Correct answer:
B) MIN()
Explanation: The MIN() function is used to return the smallest value from a selected column.
Question 15 of 50
What does the SQL clause LIMIT do?
Correct answer:
B) Limits the number of returned rows
Explanation: The LIMIT clause is used to specify the number of rows to return in a SELECT statement.
Question 16 of 50
What SQL statement is used to create a new table?
Correct answer:
B) CREATE TABLE
Explanation: The CREATE TABLE statement is used to create a new table in a database.
Question 17 of 50
How do you retrieve only unique values from a column?
Correct answer:
B) SELECT DISTINCT
Explanation: The DISTINCT keyword ensures only unique values are selected from a column.
Question 18 of 50
Which SQL clause is used to filter groups of rows?
Correct answer:
B) HAVING
Explanation: The HAVING clause is used to filter rows after grouping with GROUP BY.
Question 19 of 50
What is the function of the SQL operator IN?
Correct answer:
A) Checks if a value matches any value in a list
Explanation: The IN operator checks if a value exists within a specified list of values.
Question 20 of 50
What does the SQL statement ALTER TABLE do?
Correct answer:
B) Changes the structure of a table
Explanation: The ALTER TABLE statement is used to modify the structure of an existing table.
Question 21 of 50
Which of the following SQL keywords is used to ensure that a column does not accept NULL values?
Correct answer:
B) NOT NULL
Explanation: The NOT NULL constraint ensures that a column must have a value and cannot be left empty.
Question 22 of 50
What SQL command is used to delete a database?
Correct answer:
C) DROP DATABASE
Explanation: The DROP DATABASE statement is used to delete an existing database.
Question 23 of 50
What is the purpose of the SQL JOIN clause?
Correct answer:
B) To retrieve data from multiple tables
Explanation: The JOIN clause is used to combine rows from two or more tables based on a related column.
Question 24 of 50
Which SQL function is used to calculate the total sum of a numeric column?
Correct answer:
C) SUM()
Explanation: The SUM() function calculates the total sum of a numeric column.
Question 25 of 50
Which SQL statement is used to add a new column to an existing table?
Correct answer:
C) ALTER TABLE
Explanation: The ALTER TABLE statement is used to add a new column to an existing table.
Question 26 of 50
Which SQL statement is used to delete a specific column from a table?
Correct answer:
B) ALTER TABLE DROP COLUMN
Explanation: The ALTER TABLE DROP COLUMN statement is used to remove a column from a table.
Question 27 of 50
What is the function of the SQL operator BETWEEN?
Correct answer:
B) Filters rows between two values
Explanation: The BETWEEN operator filters rows that fall between two specified values.
Question 28 of 50
What SQL keyword is used to select records where two values match?
Correct answer:
D) LIKE
Explanation: The LIKE keyword is used to match records where a column's value matches a specified pattern.
Question 29 of 50
How do you select records where a column value starts with 'A'?
Correct answer:
B) WHERE Column LIKE 'A%'
Explanation: The LIKE 'A%' pattern matches any value starting with the letter 'A'.
Question 30 of 50
Which of the following constraints ensures that the value in a column is unique?
Correct answer:
C) UNIQUE
Explanation: The UNIQUE constraint ensures that all values in a column are different.
Question 31 of 50
Which SQL statement is used to retrieve data from a database?
Correct answer:
C) SELECT
Explanation: The SELECT statement is used to retrieve data from a database table.
Question 32 of 50
What does the SQL clause FROM specify in a query?
Correct answer:
A) Specifies the table to retrieve data from
Explanation: The FROM clause specifies the table from which to retrieve or manipulate data.
Question 33 of 50
Which of the following operators tests for the existence of rows in a subquery?
Correct answer:
B) EXISTS
Explanation: The EXISTS operator tests for the existence of rows in a subquery.
Question 34 of 50
Which SQL keyword is used to return only distinct values in a SELECT query?
Correct answer:
A) DISTINCT
Explanation: The DISTINCT keyword is used to return only unique values in a query result.
Question 35 of 50
What does the SQL clause ORDER BY do in a query?
Correct answer:
A) Orders data in a specific sequence
Explanation: The ORDER BY clause is used to sort the data in either ascending or descending order.
Question 36 of 50
What SQL command is used to add data to a table?
Correct answer:
B) INSERT INTO
Explanation: The INSERT INTO command is used to add new records to a table.
Question 37 of 50
Which SQL function returns the average value of a numeric column?
Correct answer:
A) AVG()
Explanation: The AVG() function calculates the average value of a numeric column.
Question 38 of 50
Which SQL operator is used to compare two values for equality?
Correct answer:
B) =
Explanation: The = operator is used to compare two values for equality in SQL.
Question 39 of 50
What is the default sorting order when using ORDER BY in a query?
Correct answer:
A) Ascending
Explanation: The default sorting order in SQL is ascending unless explicitly specified as descending.
Question 40 of 50
Which SQL operator is used to exclude rows that do not meet a condition?
Correct answer:
B) NOT
Explanation: The NOT operator is used to exclude rows that do not meet a specified condition.
Question 41 of 50
Which SQL clause is used to restrict the number of rows returned in a query?
Correct answer:
B) LIMIT
Explanation: The LIMIT clause is used to specify the number of rows to return in a query.
Question 42 of 50
How do you select all records where a column value ends with 'S'?
Correct answer:
B) WHERE Column LIKE '%S'
Explanation: The LIKE '%S' pattern matches any value that ends with the letter 'S'.
Question 43 of 50
What is the result of using the SQL UNION operator?
Correct answer:
B) It combines results from two SELECT queries without duplicates
Explanation: The UNION operator combines the results of two SELECT queries and removes duplicates by default.
Question 44 of 50
Which SQL keyword is used to combine rows from two tables with matching columns?
Correct answer:
B) JOIN
Explanation: The JOIN keyword is used to combine rows from two tables based on a related column between them.
Question 45 of 50
Which SQL clause is used to specify the number of rows to return in SQL Server?
Correct answer:
B) TOP
Explanation: The TOP clause is used in SQL Server to limit the number of rows returned.
Question 46 of 50
What is the SQL operator used to check for a NULL value?
Correct answer:
B) IS NULL
Explanation: The IS NULL operator is used to check if a column value is NULL.
Question 47 of 50
Which SQL clause is used to aggregate data into groups?
Correct answer:
A) GROUP BY
Explanation: The GROUP BY clause is used to aggregate data into groups based on one or more columns.
Question 48 of 50
Which SQL function is used to return the current date?
Correct answer:
C) CURRENT_DATE()
Explanation: The CURRENT_DATE() function returns the current date in SQL.
Question 49 of 50
Which SQL command is used to remove duplicates in a result set?
Correct answer:
B) DISTINCT
Explanation: The DISTINCT keyword is used to remove duplicate rows from a result set.
Question 50 of 50
Which SQL function is used to extract a portion of a string?
Correct answer:
B) SUBSTRING()
Explanation: The SUBSTRING() function extracts a portion of a string based on specified parameters.
Set 1 completeYou scored 0%
0 correct out of 0 answered (50 questions in this set).