Disclaimer:
Educational Use Only:
The website links provided are to be used strictly for educational and knowledge-gaining purposes only.
No Misuse:
Do not misuse the links or the information contained therein for any commercial, illegal, or unethical activities.
Respect for Websites and Businesses:
Respect the intellectual property and business interests of the websites and their owners. Do not attempt to alter, copy, or redistribute content without proper authorization.
Acknowledge Value of Knowledge:
Recognize and value the knowledge and resources shared by these websites. Use the information responsibly and ethically.
No Endorsement:
The provision of these links does not imply endorsement of the linked sites, their content, or their products and services. Users are responsible for evaluating the suitability and accuracy of the information.
User Responsibility:
By accessing these links, you agree to use the information at your own risk and to comply with all applicable laws and website terms of use.
Overall MCQs for Reference
- Which of the following best describes a subquery in SQL?
a. A query nested within another querytutorialspoint
b. A query executed after the main query
c. A query run outside the main statement
d. A query that duplicates results
Answer: atutorialspoint - What is the main use of subqueries in data science?
a. To break complex problems into smaller querieshightouch
b. To visualize raw data
c. To execute parallel queries
d. To speed up all SQL queries
Answer: ahightouch - In which clauses can a subquery be placed?
a. SELECT, FROM, HAVING, WHEREtutorialspoint
b. GROUP BY, ORDER BY
c. ONLY WHERE
d. ONLY SELECT
Answer: atutorialspoint - What must each subquery include at minimum?
a. A SELECT and a FROM clausetutorialspoint
b. A HAVING clause only
c. An ORDER BY clause only
d. An aggregate function only
Answer: atutorialspoint - Which type of subquery returns a single value?
a. Scalar subquerydataquest
b. Multi-row subquery
c. Correlated subquery
d. Nested subquery
Answer: adataquest - What are the two major types of subqueries?
a. Single-row and multi-rowstudocu
b. Ordered and grouped
c. Scalar and vector
d. Temporary and permanent
Answer: astudocu - What does a correlated subquery do?
a. References columns from the outer queryalooba
b. Ignores outer query values
c. Runs independently of the main query
d. Always returns a single value
Answer: aalooba - Which operator is commonly used with multi-row subqueries?
a. INstudocu
b. LIKE
c. JOIN
d. HAVING
Answer: astudocu - What is necessary for a subquery to function correctly?
a. Parentheses around the subquerytutorialspoint
b. The use of JOIN
c. HAVING clause
d. DISTINCT keyword only
Answer: atutorialspoint - Which SQL clause is NOT typically associated with subqueries?
a. GROUP BYtutorialspoint
b. WHERE
c. HAVING
d. SELECT
Answer: atutorialspoint - A subquery placed in the SELECT clause is mainly used to:
a. Return calculated or related dataherovired
b. Order the results set
c. Filter rows with LIKE
d. Remove duplicates
Answer: aherovired - Which is a benefit of subqueries in data analysis?
a. Enhanced query readability and maintainabilityhightouch
b. Increased hardware requirements
c. Reduced code modularity
d. Lower response accuracy
Answer: ahightouch - What happens if a multi-row subquery returns zero rows?
a. The outer query does not match any datadataquest
b. The query crashes
c. The outer query returns all data
d. The query runs infinitely
Answer: adataquest - What is the output of a scalar subquery?
a. Single valuedataquest
b. Multiple rows
c. Multiple columns
d. None
Answer: adataquest - In which scenarios are correlated subqueries most useful?
a. When row-wise comparisons are neededalooba
b. When joining identical tables
c. When only static values are required
d. For unrelated tables
Answer: aalooba - What is a nested subquery?
a. Subquery within another subquerysanfoundry
b. Subquery outside any query
c. Subquery in a JOIN clause
d. Subquery for temporary tables only
Answer: asanfoundry - Which operator is applicable for single-row subqueries?
a. = (equals)studocu
b. IN
c. EXISTS
d. GROUP BY
Answer: astudocu - How can subqueries help in aggregation?
a. Calculating averages, sums, or counts dynamicallyhightouch
b. Sorting only
c. Returning only static results
d. Removing records
Answer: ahightouch - Which is NOT a common use of subqueries?
a. Creating temporary stored procedures
b. Filtering based on another query resulthightouch
c. Aggregation in queries
d. Complex condition evaluation
Answer: ahightouch - Which function is valid inside a subquery?
a. SUMherovired
b. DISTINCT only
c. ORDER BY only
d. No functions allowed
Answer: aherovired - Subqueries are feature of which database type?
a. Relational databaseshightouch
b. NoSQL databases only
c. Flat file databases only
d. None
Answer: ahightouch - Which clause is most often used with correlated subqueries?
a. WHEREalooba
b. ORDER BY
c. GROUP BY
d. HAVING
Answer: aalooba - What occurs if SELECT in subquery returns different column type than outer query?
a. Type mismatch errorstudocu
b. No impact
c. Additional rows are added
d. Nested query fails silently
Answer: astudocu - What kind of queries can subqueries replace in some instances?
a. JOINshightouch
b. Views
c. Temporary tables
d. Database triggers
Answer: ahightouch - Subqueries allow for:
a. Conditional selection of rows without explicit join logicdatacamp
b. Automatic index creation
c. User login management
d. Hardware upgrades
Answer: adatacamp - Which operator should be used with multi-row subqueries?
a. ANYstudocu
b. JOIN
c. WHERE
d. SELECT
Answer: astudocu - What is possible with nested subqueries?
a. Multi-level filtering and calculationssanfoundry
b. Single-table sorting only
c. Duplicating entire tables
d. Preventing code execution
Answer: asanfoundry - Where can you NOT use a subquery in SQL?
a. BETWEEN clauseherovired
b. SELECT clause
c. FROM clause
d. WHERE clause
Answer: aherovired - Subqueries in SQL are most similar to which logical process?
a. Step-wise problem solvinghightouch
b. Simultaneous branching
c. Direct recursion
d. Hardware communication
Answer: ahightouch - What is returned if a subquery inside WHERE clause does not find a match?
a. Outer query returns no rowsdataquest
b. Outer query duplicates rows
c. Outer query fails
d. Outer query runs infinitely
Answer: adataquest - An EXISTS subquery returns:
a. TRUE or FALSE based on filtered resultsgeeksforgeeks
b. Complex objects
c. Only numbers
d. Always NULL
Answer: ageeksforgeeks - Which technique can subqueries help simplify?
a. Conditional aggregationhightouch
b. Table creation
c. Index updates
d. Password management
Answer: ahightouch - Which subquery type references columns from the main query for each row?
a. Correlated subqueryalooba
b. Scalar subquery
c. Inline subquery
d. Primary subquery
Answer: aalooba - Which of the following is TRUE about subqueries?
a. They can be nested inside other subqueriessanfoundry
b. Only allowed in WHERE clause
c. Cannot use aggregate functions
d. Always return multi-row results
Answer: asanfoundry - Why are subqueries important for data scientists?
a. Allow dynamic, layered filtering and analysisdatacamp
b. Replace all aggregation functions
c. Make databases faster always
d. Eliminate the need for indexes
Answer: adatacamp - Which clause uses subqueries for generating temporary tables?
a. FROMtutorialspoint
b. HAVING
c. GROUP BY
d. ORDER BY
Answer: atutorialspoint - Which function does NOT work inside a subquery?
a. SLEEP functionherovired
b. SUM function
c. AVG function
d. COUNT function
Answer: aherovired - What is TRUE about multi-column subqueries?
a. They can return multiple columns in result setstudocu
b. Only single column allowed
c. Cannot be correlated
d. Always nested in SELECT
Answer: astudocu - What is best practice with subqueries to enhance maintainability?
a. Keep them small and well-definedhightouch
b. Use them for sorting only
c. Always nest deeply
d. Avoid conditional statements
Answer: ahightouch - What is the purpose of HAVING clause with a subquery?
a. Filter aggregated resultstutorialspoint
b. Sort rows
c. Count total records
d. Assign column aliases
Answer: atutorialspoint - When should you avoid subqueries in data science workflows?
a. When simple JOIN handles the logic fasterhightouch
b. In all SELECT statements
c. When handling aggregation
d. For all sorts of filtering
Answer: ahightouch - Which error is common with subqueries in large databases?
a. Performance slowdowns due to repeated executionshightouch
b. Hardware failure
c. Network packet loss
d. User permission errors
Answer: ahightouch - Which subquery can be used in inserting or updating records?
a. Subquery in INSERT or UPDATE statementslearn.microsoft
b. Subquery in DROP statements
c. Subquery in ALTER statements only
d. Subquery in GRANT statements
Answer: alearn.microsoft - For which type of analysis are subqueries especially helpful?
a. Time-series moving averagesdatacamp
b. Table creation
c. Password resets
d. Index generation
Answer: adatacamp - What should be matched when comparing values in subqueries?
a. Number and type of columnsstudocu
b. Query execution time
c. Row order
d. Hardware version
Answer: astudocu - Subqueries improve SQL by enabling:
a. Layered filtering, comparison, and transformationdatacamp
b. Eliminating group functions
c. Hard coding all results
d. Duplicating tables
Answer: adatacamp - Which potential disadvantage comes with subquery usage?
a. May lead to complicated SQL statements difficult to debugherovired
b. Improved hardware compatibility
c. Ensured code simplicity
d. Always faster execution
Answer: aherovired - What do subqueries facilitate in reporting?
a. Advanced filtering and summarizationherovired
b. Direct report formatting
c. Only visualization
d. Constant runtime
Answer: aherovired - When using subqueries, what is key to error prevention?
a. Matching column types and values preciselystudocu
b. Choosing random clause placement
c. Running queries in parallel always
d. Ignoring SQL warnings
Answer: astudocu - Which scenario indicates inappropriate subquery usage?
a. When a simple JOIN gives better performance and clarityhightouch
b. When advanced filtering is needed
c. When results need aggregation
d. When only single-table filtering is required
Answer: ahightouch
- https://www.tutorialspoint.com/sql_certificate/subqueries_to_solve_queries_questions.htm
- https://hightouch.com/sql-dictionary/sql-subqueries
- https://www.dataquest.io/tutorial/sql-subqueries-tutorial/
- https://www.studocu.com/row/document/kwame-nkrumah-university-of-science-and-technology/computer-science/subqueries-mcqs/96125061
- https://www.alooba.com/skills/concepts/sql-19/subqueries/
- https://herovired.com/learning-hub/topics/sql-subquery/
- https://www.sanfoundry.com/rdbms-questions-answers-nested-subqueries/
- https://www.datacamp.com/tutorial/sql-subquery
- https://www.geeksforgeeks.org/sql/sql-subquery/
- https://learn.microsoft.com/en-us/sql/relational-databases/performance/subqueries?view=sql-server-ver17
- https://www.sanfoundry.com/sql-questions-answers-sql-subqueries/
- https://www.geeksforgeeks.org/quizzes/sql-quiz-5/
- https://www.includehelp.com/sql/mcq-sql-sub-queries-views-clause.aspx
- https://www.sanfoundry.com/sqlserver-mcqs-subqueries/
- https://www.gyansetu.in/blog/sql-query-mcq-quiz-with-answers/
- https://edurev.in/test/28320/Test-Nested-Subqueries-in-SQL
- https://testbook.com/objective-questions/mcq-on-nested-queries–5eea6a0939140f30f369da8d
- https://www.w3resource.com/sql-exercises/subqueries/index.php
- https://study.com/academy/practice/quiz-worksheet-advanced-sql-subqueries.html
- https://mode.com/sql-tutorial/sql-sub-queries/