JOIN me while I SQL
Not sure if I’m doing an adequate job keeping up with my journal entries. Keeping up with coding activities involve typing at an extreme rate for several hours on end and activating parts of my brain i didn’t know i had. This makes me extremely uncomfortable. Keeping up with this journal involves aggregating the data i am trying to lean on for coding exercises while at the same time flexing brain muscle to understand the concepts and syntax.
It’s a rush!
Targets for the day are to learn to SQL or postgresql more specifically. I took some time last night i had reserved for reading today’s material, in order to install postgresql on my machine. I ran into some problems with this but I gained some key insight into manipulating packages and files from the command line. It was cool.
Now for the notes:
To create a new database:
psql readychef < readychef.sql
This is provided readychef.sql exists.
to access the databas:
\d **table name**
will show you the tables in the database and their respective columns, respectively…
SELECT is for what columns i want to include in the query. Using aliasing to rename a column. Aggregate data if you want sums, counts, avg.’s, min’s, …, so on and so forth.
Queries for multiple JOIN clauses can take multiple tables and allow you to see across them in multiple tables. You are supposed to think of it a bit like a “Venn” diagram where you can see the overlaps with an INNER JOIN.
LEFT OUTER JOIN customers AS c
Two things from this morning:
Aliasing can NOT be used in WHERE or HAVING clauses
Aliases can and apparently should be used in GROUP BY clauses.
There was more… way way more. I’m going to get some rest and try and figure out more of it tomorow!