|
|
However:
|
|
Employees:
ssn fname lname salary superssn dno
--------- ------ -------- --------- --------- -----------
123456789 John Smith 20900.00 333445555 5
333445555 Frankl Wong 50000.00 888665555 5
999887777 Alicia Zelaya 25000.00 987654321 4
987654321 Jennif Wallace 43000.00 888665555 4
666884444 Ramesh Narayan 38000.00 333445555 5
453453453 Joyce English 25000.00 333445555 5
987987987 Ahmad Jabbar 25000.00 987654321 4
888665555 James Borg 55000.00 NULL 1
Departments:
dname dnumber mgrssn mgrstartdate
--------------- ----------- --------- ------------
Research 5 333445555 22-MAY-78
Administration 4 987654321 01-JAN-85
Headquarters 1 888665555 19-JUN-71
(More data possible, but omitted for brevity)
|
|
Graphically:
|
Demo: mySQL Database Software
/home/cs554001/bin/cs554-sql
|
|
|
Example query:
select * from employee where salary > 40000 |
|
|
Example:
select fname, lname
from employee
where salary > 50000
|
|
Schematically:
|
Main goal of this course:
|
|
|
Transfer $100 from account John to another account Jane
update BankAccount
where ID = 'John'
set balance = balance - 100
update BankAccount
where ID = 'Jane'
set balance = balance + 100
|
Result of the system failure:
|
We will study techniques to overcome system failures (logging)
|
|
|
Homer withdraws $100:
read balance; --> balance = $400
if (balance > amount) then
{
balance = balance - 100; --> balance = $300
write balance; ==> Writes: $300
}
1 hour later:
Marge withdraws $50:
read balance; --> balance = $300
if (balance > amount) then
{
balance = balance - 50; --> balance = $250
write balance; ==> Writes: $250
}
|
Final balance = $250 (correct outcome)
Homer withdraws $100:
read balance; --> balance = $400
Marge withdraws $50:
read balance; --> balance = $400
if (balance > amount) then
{
balance = balance - 50; --> balance = $350
write balance; ==> Writes: $350
}
if (balance > amount) then
{
balance = balance - 100; --> balance = $300 (400 − 100)
write balance; ==> Writes: $300
}
|
Final balance = $300 !!! (inconsisten outcome)
We will study techniques to overcome simultaneous updates (concurrency control)
|
|
|
|
We will study how to build each component.
|