- Install docker ce if you haven't already.
- Open a terminal and navigate to the root of this project
- Start mysql server
docker-compose up
- Use the name a query with the
bin/sqlrun
command to execute queries against the running database
e.g.
bin/sqlrun ./sequence.txt
Running
bin/sqlrun
without arguments will run all queries in the./queries
folder
Running
bin/sqlrun ./sequence.txt
will run queries in the order specified in the file
- Name of a table is what each row is about
- Good practice to prefix column names with the table name
- Using * is bad practice, better to be explicit
- Good practice to qualify select with table name.
SELECT person.person_id, person.person_firstname, person.person_lastname FROM person
- Best practice to qualify and to alias
SELECT
p.person_id,
p.person_firstname,
p.person_lastname
FROM person p