I am learning about database transactions and isolation levels. When I want to do some experiments on what I've read in the book, there are some difficulties.
First of all, I can't simply execute a single .sql file to see the experiment result. I have to open 2 database connections, and then type SQL commands back and forth between these 2 connections.
For example, when I want to reproduce dirty reads phenomenon, I have to do the following steps:
- Make 2 database connections.
- Create table and populate the required data.
- Run "SELECT age FROM person WHERE id = 1;" on the first connection.
- Run "UPDATE person SET age = 30 WHERE id = 1;" on the second connection.
- Run "SELECT age FROM person WHERE id = 1;" on the first connection.
- See the results.
There are some problems:
- It's really tedious to type the same SQL commands over and over again for different isolation levels.
- It's hard to take notes of what I've learned from a bunch of messy SQL commands.
- There is no easy way to share the experiments I've done.
Is there any good tool to solve these problems?
First of all, I can't simply execute a single .sql file to see the experiment result. I have to open 2 database connections
" ... why? Do you have some strange setup? Or could it be that you have misunderstood some concept? If you can explain to us … the more detail you give in your question, the better the help that you will receive.