From A to SQL — documenting my learning journey in structured query language
As an individual who is kickstarting their career in data, I know how vital it is to have knowledge and experience of structured query language — usually simply referred to as SQL. If you complete a simple Google search, you’ll find that SQL is frequently seen in the Top 10 data skills of 2022. My first encounter with SQL occurred in October 2021, when I started my new job as a Data Analyst. During my first few weeks, the foundations of SQL were covered in an intensive two-day technical bootcamp session. As someone who comes from a Psychology background, many of these concepts were almost alien to me, and words like ‘primary key’ and ‘foreign key’ just sounded like arbitrary phrases rather than terms with actual meaning! I found it a little overwhelming, and quickly fell into ‘active procrastination’, where I put off practicing SQL by focusing on other skills which I found easier and believed I could better succeed in.
However, when I reached my mid-year review and took time to reflect, I realised I achieved many of the goals I set for myself in learning Python and HTML, but SQL seemed left behind in 2021. Therefore, I decided that the time is now to do something about it. My goal for the next 6 months is to proactively work to develop my skills. Hence, in the name of reflection, accountability, and a bit of fun, I have chosen to document my learning journey in a series of blogs titled ‘From A to SQL’.
Ready? Set? SELECT
Part A — The beginning
I decided the best way to start this journey would be to refresh my memory on the foundations that I learned back in October. The ‘SQL Essentials Training’ course on LinkedIn Learning provided an easy but comprehensive overview of the language, which was a perfect refresher.
The course covered:
· SELECT, INSERT, UPDATE and DELETE statements
· Creating, updating, and deleting tables
· Filtering data using a WHERE clause and ORDER BY to sort data
· Relationships, including JOIN, LEFT JOIN and RIGHT JOIN
· String manipulation, transactions, and aggregate functions
To practice my skills, I got stuck straight in and completed some basic queries which were covered in the course. I downloaded SQLiteStudio and uploaded a ‘world’ and ‘test’ databases — made available to me through my membership with LinkedIn learning.
The ‘world’ database contains 3 tables: city, country, and country language. I used three simple SELECT statements to view the tables in further details, so that it was clear what columns and data was available.
I then completed a more complex SELECT statement, choosing to retrieve the name (changed to ‘Country’ as an alias), Life Expectancy, Region, and Continent from the country table, where the continent was either Europe or Asia. I added an additional ORDER BY clause, to sort the results in the table by life expectancy in descending order, followed by region in alphabetical order, where life expectancy was the same.
After this, I also practiced completing an inner join on the city and country table.
Finally, I ended my SQL practice session by inserting and updating rows in a table. I switched to the ‘test’ database and viewed all the data in the customer table. I then added a row of data into the customer table for a fictional customer — Anna Smith.
I realised I executed this command twice by mistake (whoops), so I wrote a statement to update the last row of data in the customer table, with new details for a different fictional customer — John Smith.
These may seem like very simple SQL statements, but it’s important to remember that we all start somewhere. Being able to practice what I have learned whilst following the course is the best way for me to understand the concepts — and a great way to problem solve when I inevitably got an error for missing a semi-colon! I’m committed to improving and practicing my skills further, and I’m excited to continue to share this with you.
Keep your eyes peeled for the next sequel of my blog :)