- use an IDE preferably with syntax highlighting
- run the code every time you write a statement
- split the code in several files
- try not to jump ahead
You should be able to execute the statements more than once without errors and without changing the structure or the content of the database.