Back to articles list Articles Cookbook
9 minutes read

What Is SQL Used For?

So you’ve heard about databases and SQL, but you’re not sure what the big deal is. Read on to find out why data skills like SQL are so important.

It seems like every other job requires you to know something about data, databases, and SQL. But what are these things, and what are they used for? Who even uses SQL? That’s what we’ll discuss in this article.

Why Data Is So Important

The Internet and the technology revolution have brought unprecedented opportunities. One of the biggest enablers of this tech revolution has been advances in data storage, retrieval, and manipulation. Organizations that capture and use this data have a huge competitive edge over their peers; this is one of the reasons Google, Amazon, and Facebook (now Meta) are valued so highly. Similarly, individuals who know how to use data to enable business growth are in high demand.

Fortunately, some of the tools for accessing and using data are not too difficult to learn. One such tool is SQL (Structured Query Language), which lets you “talk” to databases. If you already have some idea regarding SQL and are thinking about learning it, I would recommend you start with our SQL Basics course.

But if you are completely new to SQL, read on! In the following sections, I will cover how you can use SQL in many different roles. But before that, let’s have a quick refresher on databases and SQL.

What Is a Database and What Is SQL?

A database is a software program that facilitates storage of structured information. It provides the necessary framework for performing transactions on that data. SQL is a programming language that helps you store, retrieve, and manipulate the data in a database.

Most apps and programs that work with data have one or more databases working in the background. To converse with these databases, you need SQL. However, there are different dialects of SQL that work with different databases. (Think of the different dialects of English, French, etc. and you’ll get the right idea.) Some of the most popular databases (and SQL dialects) are Oracle, MySQL, MS SQL Server and PostgreSQL.  But if you want to work with different databases, you don’t have to learn a new dialect for each database. With some minor differences, the language is mostly similar across databases.

Now, you know that MS Excel enables you to work with data. So why learn SQL? A major reason is that SQL enables you to work with volumes of data that Excel would not be able to support without crashing. Most SQL databases enable you to work with millions of transactions, store terabytes of data, and get results in seconds.

So now that you understand what SQL is, let’s see who uses it.

Who Uses SQL?

With the way SQL has been described, you might think that SQL is only for IT pros, data analysts or data engineers.

While SQL is a must-have skill for data analysts and engineers, it is an important addition to any career that uses data. And that makes SQL worth considering for just about anybody.

In fact, having worked in different roles throughout my career – including technology, business strategy, and supply chain management – I can vouch for the importance of SQL. It has helped me do my work much more effectively.

To give you further insight into the usage of SQL, let me take you through some real-world use cases in various tech and non-tech roles.

Software Developer (Programmer)

A software developer typically interacts with the database through the code they write. Imagine you are a programmer tasked with developing a new feature for a wine website. As part of this feature, you’ll ask the site visitors for their wine preferences – soft or acidic, dry or sweet, smooth or tannic, etc. You’ll provide a scale of 1-10 for each preference; this data will be used to create customized wine recommendations for each customer.

Each customers’ preferences will be stored in one database table; the wine characteristics will be matched with another table that stores different kinds of wines. As a programmer, you will use SQL INSERT statements through a database connectivity library or application programming interface (API) to store this preference. You will then use another SQL statement/query to retrieve the best wines for that customer.

Note: Curious about statements, queries, and the other SQL terms used above? Check out SQL Terms Beginners Should Know for more info.

Software Tester

Now say the feature described above needs to be tested. A tester will create sample transactions and then test whether the data has been captured as needed. They may also create test data sets and use SQL to insert them into the database. After doing the test transactions, they’ll verify the results with a SELECT statement to retrieve the processed data.

Data Analyst

In most organizations, data analysts support business functions like tech, HR, operations, marketing or finance by handling data requests or reports. Depending on seniority and their organization, the data analyst may be responsible for making the data available in a particular format or deriving insights from the data that uncover growth opportunities or solve a problem.

In our online wine store example, suppose the marketing department wants to ensure there’s a good selection for the top 5 wine categories. A data analyst would make a report showing these top 5 categories. Using SQL, the analyst writes a query to retrieve the data (i.e. the relevant rows and columns from tables storing wine and order/preference information). Once it’s written, the same query can be used and refreshed as needed.

While databases themselves can be used to view business data, many analysts also employ visualization software like Tableau, Amazon QuickSight, or Microsoft Power BI to attractively present the results of their query.

Business Analyst

Historically, a business analyst’s primary responsibility was to translate business requirements to tech specifications. These could then be worked on by application developers or data analysts. Therefore, a business analyst needed to understand tech as well as that business, industry, or domain. While this is still true, most of today’s business analysts also understand how an organization’s data can be put to use.

For instance, imagine that you are a business analyst for an online hotel booking company. For the upcoming holiday season, you want to drum up sales specifically from inactive customers. You start with a list of all customers who have not visited the website in the last three months.

Typically web analytics data (like a list of site visitors) can be linked with your customer database to track user behavior. You can use SQL to get this list of customers and their email addresses from the database. The information can then be used to email a special discount that encourages these customers to make a purchase.

Data Engineer

A data engineer is responsible for creating appropriate data structures and data pipelines for an optimum flow of large volumes of data in an organization.

SQL is essential for a data engineer, since they need to create tables and other structures. They also need to establish the relationships between different tables, following business rules.

Imagine how a typical retail database might look. There would be a table housing customers’ order information. Customer information, including an ID number unique to each individual, would be stored in another table; each time a customer placed an order, a record with their ID number would be stored in the order table. That customer ID number would link those two tables, thus connecting the customer with that order. The order table would also be linked to other tables, such as one holding item data. In turn, the order table would be used to generate various reports.

Data engineers create this complex web of tables; they also ensure this data is available to algorithms and other programs. Without SQL knowledge, this would be a difficult task!

Data Scientist

The role of a data scientist entails creating hypotheses and then using data and scientific methods to statistically or mathematically prove or disprove them. In the corporate world, this data is generally in databases (which require SQL knowledge). In fact, SQL also offers a rich library of mathematical functions that can analyze various groups of data.

Data scientists also use statistical software like SPSS, R, and Python to do detailed studies of the data. But even these tools can be linked to SQL to create a clean set of base data, which can be further worked upon as needed.

Business Manager

While not widely seen as a necessary skill in this area, SQL can really help differentiate a great business manager from a good one.

The usual task of a business manager is to facilitate the smooth functioning of business, solve a business problem, or enable business growth.

To make sure that things are running properly, one must put mechanisms in place to measure key performance indicators. For instance, a sales manager may measure total sales, sales per employee, salesperson productivity etc. A production planning manager would measure the number of items produced or the number of defects; other departments will have their respective metrics. This measurement and reporting can be facilitated by SQL.

A data or business analyst may help managers with this data. But what about ad hoc analysis that cannot wait? Or ascertaining an initial opportunity for a problem that’s not well defined? This is where SQL comes in useful for business managers.

Great managers are always comfortable understanding and working with data to uncover opportunities and create growth opportunities. SQL equips them to do independent and ad hoc analysis quickly. Below are some examples of where a manager might employ SQL:

  1. Analyzing financial data to optimize costs and find which departments are eating away at cash flows.
  2. Uncover and segment consumer behavior patterns to optimize your offering.
  3. Identify bottlenecks in your processes and promote continuous improvement.
  4. Find top salespeople and highest-selling items to see who or what is driving your business.
  5. Understand which part of your production process contributes to the most defects to correct it.

Of course, these are mere examples to show some use cases. In theory, this list is infinite.

Time to Learn SQL!

By now, you’ve realized how SQL can add value to your work and career. If you are wondering how to begin learning it, I recommend the SQL A to Z track from LearnSQL.com. This comprehensive set of 7 interactive courses features ample exercises where you can sharpen your skills and get used to writing queries. The fact that around 50K users have already enrolled for this course speaks for its popularity. On top of that, you do not need to install any software to get started. An Internet browser is enough.

If online learning is not your cup of tea and you prefer books, this article on the best SQL books will help you get started. However, I would encourage you to practice your query-writing skills regularly. Either way, enjoy learning SQL!