W5 - SQL Finish + Transactions & Concurrency Control

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/8

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

9 Terms

1
New cards

Nested SQL queries

Nesting a query in another query

<p>Nesting a query in another query</p>
2
New cards

SQL Operators

  • Use IN and NOT IN

  • EXISTS returns TRUE if the set is nonempty (NOT IN does the opposite)

  • UNIQUE can be used, but not for checking tuple-by-tuple, only for an entire subquery. (Can also use NOT UNIQUE)

  • ANY and ALL

    • ANY returns true if there exist tuples which obey condition

    • ALL returns true if all tuples obey condition

3
New cards

SQL Aggregate Operators

COUNT (*) - Counts everything returned

COUNT ( [DISTINCT] A ) - Counts set

AVG ( [DISTINCT] A) - Returns average of a set

SUM ( [DISTINCT] A) - Finds sum of set

MAX (A) - Finds highest value

MIN (A) - Finds smallest value

4
New cards

GROUP BY, HAVING

GROUP BY sorts a set by an attribute in ascending order

HAVING further sorts a set by a value of that attribute

<p>GROUP BY sorts a set by an attribute in ascending order</p><p>HAVING further sorts a set by a value of that attribute</p>
5
New cards

What counts as a transaction?

Each movement of money

  • If PLAYER1 gives PLAYER2 100, that is one transaction

    • PLAYER1 bal -100
      PLAYER2 bal +100

    • /\ One transaction

<p>Each movement of money</p><ul><li><p>If PLAYER1 gives PLAYER2 100, that is one transaction</p><ul><li><p>PLAYER1 bal -100<br>PLAYER2 bal +100</p></li><li><p>/\ One transaction</p></li></ul></li></ul><p></p>
6
New cards

Concurrency

Interleaving execution of operations such as money transfer and account sum

  • Each transaction is seen as a sequence of read and write

7
New cards

Schedules

List of actions from a set of transactions

  • No guarantee that T1 will execute before T2 if both are submitted concurrently

<p>List of actions from a set of transactions</p><ul><li><p>No guarantee that T1 will execute before T2 if both are submitted concurrently</p></li></ul><p></p>
8
New cards

Types of schedules

Complete - A schedule that contains an abort or commit action for every transaction that occurs in the schedule

Serial - A schedule where the actions of different transactions are not interleaved

9
New cards

Conflicting Operations

Two operations conflicting if:

  • They belong to different transactions

  • They operate on same data item

  • At least one of them is a write operation