Learning SQL

Toby Green

by Toby Green

17 Aug '21

In this blog, Rockborne Consultant Toby Green talks us through SQL and top tips for beginners.


As a data engineer there are many skills that are useful to possess; Data Integration, Pipelining, ETL, and more; as well as coding languages like Python and SQL, but at Rockborne we are also covering Data Science and Data Analysis tools, and techniques.



Before starting at Rockborne I had no experience of any of these systems, processes, or languages but one I have grown to love throughout the training is SQL. For those that don’t know, SQL (Structured Query Language) is a special purpose programming language that is used to manipulate relational databases.



Whilst there are always new things to learn with SQL, the Rockborne training has introduced me to a wide range of exercises across many datasets, allowing me to complete tasks using SQL code more efficiently – we did well over 200+ exercises and examples across SQL. One of the most useful skills I have developed through SQL is the use of ‘Joins’. ‘Joins’ are a way of merging two tables together to form one table. This is particularly useful if you have information in two different tables that you want to combine to perform analysis on. A ‘Join’ works by using a key from each table which when the same will combine the information based on the type of join that is desired.



The best way to visualise this information is through the use of Venn diagrams as seen below:

Figure 1: A Venn diagram representing a ‘left join’

A left join keeps all the information from the table on the left and adds only the data from the right table which key matches the key from the left table.



A right join does the same, except for all the information is kept from the table on the right and only select information that is matched by the key from the left table is kept.



An inner join combines only the data for which the key is the same in both tables. In the Venn diagram this would be the small area that intersects both circles.



An outer join combines all the information from both tables.


Top Tips for Beginners Using SQL:



Format your code correctly: Formatting your code correctly will not only allow for you to easily review your own code but allow others to review it and help should you come across any issues. Capitalising words and using the correct indents helps to do this.



Add comments to code: adding comments to code allows you to easily come back to previously written pieces of code and understand what the code is trying to do. Like the above point, it also helps other people to look at your code.



The internet is your friend: Learning a new syntax can be challenging, using the internet can be beneficial to aid your learning. It is most likely that any problem you are having someone has had before and searching what you are trying to do or searching for an error can help you to find a solution to your problem.



Practice: Like with anything practice helps to gain a further understanding. When given the opportunity try out your newfound skills and see if you can apply them to any other situations. The more you practise the more familiar you will become with the language.



Want to know more about life as a Rockborne consultant? Read THIS blog


Want to know more about our world leading program? Click HERE


Twitter logo icon LinkedIn logo icon