Definition
The acronym SQL stands for “Structured Query Language”. It refers to a standardized computer programming language that is used for creating, altering and querying data in many relational database management systems. Basically, a query – as its name suggests – is a question that you ask or a request you send to a database.
Given that SQL is a universal language, it proves very useful and appropriate for easy communication and collaboration. It’s also quite flexible and versatile, which means that once you know the basics, you can do a lot of things with it.
This makes SQL queries essential for any organization that strives to be data-driven: it empowers stakeholders to access and manipulate data while staying organized and following a clear-cut structure. Without SQL queries, extracting meaningful data from a relational database can be tricky, and data management processes tend to become quite complex and time-consuming.
In a relational database, information is stored in tables, each one representing a specific entity type. In these tables, the rows are fields that indicate the instances of this type of entity, whereas the columns indicate the values attributed to that instance.
In order to make the most of a relational database, you need to make clear and accurate SQL queries – which means that you need to know:
You want to know the number of organizations created in Husprey since January 1st 2022. For confidentiality reasons, all the data presented below has been changed.
Your database table is called product.organization, and is structured as such:
Your SQL query is written as such:
Here is an explanation of each row of the query:
After running the query, a result table will appear, as the count of New Organizations per month:
For your SQL queries to be useful and beneficial, you need to prioritize clarity: only then will stakeholders be able to understand the queries, and limit the number of errors.
You also need to make your SQL queries as exhaustive and explicit as possible, so as to encourage and facilitate collaboration:
This will also enable stakeholders to understand and reuse these queries in the future!