Sign Up Free

SQL: Which One Doesn't Belong

Odd One Out 15 questions Computer Science & Technology > SQL by Ethan Cale
Study this material interactively with flashcards, quizzes, and games on GabaBrain.
Study on GabaBrain

Odd One Out (15)

Question 1
Which of these SQL clauses is not used to filter rows based on conditions?
  • ON
  • HAVING
  • WHERE
  • ORDER BY ✓
Correct Answer
ORDER BY
WHERE, HAVING, and ON are all used to filter rows based on specified conditions. ORDER BY is used to sort the result set, not to filter rows.
Question 2
Which of these SQL aggregate functions does not ignore NULL values in its calculation for a specific column?
  • SUM(column_name)
  • AVG(column_name)
  • COUNT(*) ✓
  • COUNT(column_name)
Correct Answer
COUNT(*)
SUM(column_name), AVG(column_name), and COUNT(column_name) all ignore NULL values present in column_name when performing their calculations. COUNT(*) counts the total number of rows, regardless of NULL values in any specific column.
Question 3
Three of these are string functions. Which one is not?
  • UPPER()
  • LENGTH()
  • COUNT() ✓
  • SUBSTRING()
Correct Answer
COUNT()
UPPER(), LENGTH(), and SUBSTRING() are all scalar functions that operate on a single value and return a single value. COUNT() is an aggregate function that operates on a set of rows and returns a single summary value.
Question 4
Which of these subquery types is not categorized by the cardinality of its return value?
  • Correlated subquery ✓
  • Scalar subquery
  • Row subquery
  • Table subquery
Correct Answer
Correlated subquery
Scalar subqueries, Row subqueries, and Table subqueries are categorized by the number of rows and columns they return. A Correlated subquery is categorized by its execution dependency on the outer query, meaning it executes once for each row processed by the outer query, rather than by the specific cardinality of its return.
Question 5
Which of these SQL statements is not a Data Manipulation Language (DML) operation?
  • INSERT INTO
  • UPDATE
  • CREATE TABLE ✓
  • DELETE
Correct Answer
CREATE TABLE
INSERT INTO, UPDATE, and DELETE are all DML statements used to manipulate data within tables. CREATE TABLE is a DDL statement used to define the structure of a database object.
Question 6
Which of these is not a benefit of using indexes in a relational database?
  • Enhanced data integrity
  • Reduced data redundancy ✓
  • Improved query performance
  • Faster data retrieval
Correct Answer
Reduced data redundancy
Improved query performance, faster data retrieval, and enhanced data integrity (e.g., for unique indexes) are primary benefits of using indexes. Reduced data redundancy is primarily achieved through proper database normalization, not directly by indexing.
Question 7
Which of these SQL clauses cannot directly use aggregate functions in its condition without a subquery?
  • WHERE ✓
  • GROUP BY
  • SELECT
  • HAVING
Correct Answer
WHERE
HAVING and SELECT clauses can directly use aggregate functions. GROUP BY is used to define the groups for aggregation. The WHERE clause filters individual rows before aggregation, so it cannot directly use aggregate functions in its condition.
Question 8
Which of these is not a type of integrity constraint enforced at the column or table level in SQL?
  • PRIMARY KEY
  • FOREIGN KEY
  • UNIQUE
  • ALTER TABLE ✓
Correct Answer
ALTER TABLE
PRIMARY KEY, FOREIGN KEY, and UNIQUE are all types of integrity constraints used to enforce data rules within a database. ALTER TABLE is a Data Definition Language (DDL) command used to modify the structure of an existing table, not a constraint type itself.
Question 9
Which of these is not a common technique used to improve SQL query execution speed?
  • Optimizing join conditions
  • Increasing disk I/O latency ✓
  • Creating appropriate indexes
  • Rewriting complex subqueries
Correct Answer
Increasing disk I/O latency
Creating appropriate indexes, optimizing join conditions, and rewriting complex subqueries are all techniques to improve query execution speed. Increasing disk I/O latency would degrade query performance, not improve it.
Question 10
Which of these SQL keywords is not used to explicitly include all rows, including duplicates, in a SELECT query result?
  • LIMIT
  • DISTINCT ✓
  • TOP
  • ALL
Correct Answer
DISTINCT
ALL is used to explicitly include all rows, including duplicates. TOP and LIMIT are used to restrict the number of rows returned, which can include duplicates if they are among the top/limited set. DISTINCT is used to return only unique rows, thereby excluding duplicates.
Question 11
Which of these does not belong to the explicit JOIN clause syntax?
  • WHERE ✓
  • NATURAL JOIN
  • USING
  • ON
Correct Answer
WHERE
ON, USING, and NATURAL JOIN are all specifically used to define the join condition between two tables. The WHERE clause is used to filter rows after the join has occurred, based on any condition, not specifically to define the join relationship itself.
Question 12
Which of these subquery types cannot return a set of rows and columns?
  • Scalar subquery ✓
  • Table subquery
  • Row subquery
  • Correlated subquery
Correct Answer
Scalar subquery
Row subqueries can return multiple columns but only one row. Table subqueries can return multiple rows and multiple columns. Correlated subqueries are a type of subquery that depends on the outer query for its execution and can return any of the other types. Scalar subqueries are strictly limited to returning a single row and a single column.
Question 13
Which of these SQL keywords is not used for defining or modifying database objects?
  • DROP
  • ALTER
  • CREATE
  • SELECT ✓
Correct Answer
SELECT
CREATE, ALTER, and DROP are all Data Definition Language (DDL) keywords used for defining or modifying database objects. SELECT is a Data Manipulation Language (DML) keyword used for retrieving data.
Question 14
Which of these clauses is NOT processed before the WHERE clause in the logical execution order of a SELECT statement?
  • HAVING
  • ORDER BY
  • GROUP BY ✓
  • FROM
Correct Answer
GROUP BY
The FROM clause is processed before the WHERE clause. The GROUP BY, HAVING, and ORDER BY clauses are all processed after the WHERE clause in the logical execution order of a SELECT statement.
Question 15
Which of these techniques does not improve the efficiency of data access, and instead reduces the amount of data processed?
  • Using appropriate JOIN types
  • Filtering rows with WHERE ✓
  • Avoiding full table scans
  • Creating B-tree indexes
Correct Answer
Filtering rows with WHERE
Creating B-tree indexes, using appropriate JOIN types, and avoiding full table scans are all techniques that focus on improving the efficiency of data access (how quickly data is found). Filtering rows with a WHERE clause primarily reduces the amount of data that needs to be processed, rather than improving the access mechanism itself.

Ready to study SQL: Which One Doesn't Belong?

Study with flashcards, play quiz games, challenge your friends, and track your progress.

Start Studying Free