SnapCards

Computer Science: Advanced SQL

20 cards|
6 easy10 medium4 hard
computer sciencesqldatabasesadvanced

Subqueries, window functions, CTEs, and advanced SQL techniques.

Study these flashcards with spaced repetition

Track your progress, master difficult cards, and export to Anki. Free to start.

Start Studying — Free

Flashcards in This Deck

1
easy

What is a scalar subquery in SQL?

A scalar subquery is a subquery that returns exactly one value (one row and one column), which can be used in expressions where a single value is expected.

2
easy

Which keyword is used to define a Common Table Expression (CTE)?

The WITH keyword is used to define a CTE, allowing for a temporary named result set that can be referenced within a SELECT, INSERT, UPDATE, or DELETE statement.

3
easy

What is the result of a CROSS JOIN between two tables?

A CROSS JOIN produces a Cartesian product, where every row from the first table is combined with every row from the second table.

4
easy

In the context of transactions, what does the COMMIT command do?

The COMMIT command permanently saves all changes made during the current transaction to the database, making them visible to other users.

5
easy

What is a database View?

A View is a virtual table based on the result-set of an SQL statement; it does not store data physically but provides a way to simplify complex queries.

6
easy

What is the primary purpose of the EXPLAIN statement in SQL optimization?

The EXPLAIN statement is used to show the execution plan of a query, detailing how the database engine intends to join tables and use indexes.

7
medium

Explain the difference between the RANK() and DENSE_RANK() window functions.

RANK() leaves gaps in the numbering sequence when there are ties (e.g., 1, 2, 2, 4), whereas DENSE_RANK() does not leave gaps (e.g., 1, 2, 2, 3).

8
medium

How do the LEAD() and LAG() window functions differ in their operation?

LEAD() provides access to a row at a specified physical offset after the current row, while LAG() provides access to a row at a specified physical offset before the current row.

9
medium

What characterizes a correlated subquery?

A correlated subquery is a subquery that references one or more columns from the outer query, meaning it must be executed repeatedly for each row processed by the outer query.

10
medium

What is a recursive CTE and what are its two main components?

A recursive CTE is a CTE that references itself to handle hierarchical data. It consists of an 'anchor member' (base query) and a 'recursive member' joined by a UNION ALL.

+10 more cards — sign up to see all

Frequently Asked Questions

How many flashcards are in this Computer Science: Advanced SQL deck?

This deck contains 20 flashcards with a mix of difficulty levels: 6 easy, 10 medium, and 4 hard cards.

Is this flashcard deck free to use?

Yes! You can study these flashcards for free with our spaced repetition system. Create a free account to track your progress and save your study history.

Can I export these flashcards to Anki?

Pro users can export any deck to Anki (.apkg format) with one click. Free users can export to CSV. Start studying for free and upgrade when you need Anki export.

What is spaced repetition?

Spaced repetition is a study technique that shows you cards at increasing intervals based on how well you know them. Cards you struggle with appear more often, while mastered cards are shown less frequently. This is proven to be one of the most effective ways to memorize information.

Related Flashcard Decks

Ready to study?

Create a free account and start studying these flashcards with spaced repetition.

Get Started — Free