transactions

main
Matthew Huntington 2 years ago
parent c327f85ad7
commit f28d1e6869

@ -180,9 +180,39 @@ CREATE TRIGGER archive_person
DELETE FROM people WHERE id = 1; DELETE FROM people WHERE id = 1;
``` ```
### Transactions ### Transactions
```sql
BEGIN;
INSERT INTO people (name) VALUES ('matt');
SELECT * FROM people;
-- start a different session and run SELECT * FROM people;
-- Switch back to original session
COMMIT;
-- in other session run SELECT * FROM people;
```
OR
```sql
BEGIN;
INSERT INTO people (name) VALUES ('matt');
SELECT * FROM people;
asdfasdfasdfasdfasdfasdf;
ROLLBACK;
SELECT * FROM people;
```
### Locks ### Locks
### Privileges ### Privileges

Loading…
Cancel
Save