Difference between revisions of "Transactions"

From SQLZOO
Jump to navigation Jump to search
(Created page with "*Two sessions, with and without transactions *We create the bank of wealth - it has two customers, they both have £100 +--------+--------+ | cust | amount | +--------+--...")
 
Line 1: Line 1:
 +
==BEGIN==
 
*Two sessions, with and without transactions
 
*Two sessions, with and without transactions
 
*We create the bank of wealth - it has two customers, they both have £100
 
*We create the bank of wealth - it has two customers, they both have £100
Line 17: Line 18:
 
INSERT INTO wealth VALUES ('brian', 100);
 
INSERT INTO wealth VALUES ('brian', 100);
 
</source>
 
</source>
 +
</div>
  
 
{{#ev:youtube|GwGKUMvZBTM}}
 
{{#ev:youtube|GwGKUMvZBTM}}

Revision as of 14:47, 31 October 2016

BEGIN

  • Two sessions, with and without transactions
  • We create the bank of wealth - it has two customers, they both have £100
+--------+--------+
| cust   | amount |
+--------+--------+
| andrew |    100 |
| brian  |    100 |
+--------+--------+
DROP TABLE wealth;
CREATE TABLE wealth(
  cust VARCHAR(10) PRIMARY KEY,
  amount INT
);
INSERT INTO wealth VALUES ('andrew',100);
INSERT INTO wealth VALUES ('brian', 100);