It is very likely that the company where you work uses a relational database to store business data related to customers, orders or products. Having a basic understanding of how those databases work and how to access the data stored in them can go a long way in helping you to be more efficient, drive your team better and increase your overall performance.
1/ How is a relational database structured?
Let’s imagine you run a business selling products to customers (pretty common, isn’t it?). You need to store data related to your customers, products and orders.
The simplest way to do that would be in Excel or Google Sheets:
We might have two customers whose names are Jon Snow (ok it’s unlikely but still) so it’s common practice to have a unique identifier (id) for each customer.
- You will store the data related to your products in a similar way
Now each order was placed by a customer. It’s important to have this information. The best way to do this is to have in the "Orders" table, the id of the customer who placed the order.
An order is associated with only one customer, but a customer can be associated to many orders.
We say there’s one to many (1:N) relation between orders and customers.
Each order has products. To simplify, let’s assume each order has only one product. So we’ll add the product_id to the order table.
Again, there’s a one to many relationship between orders and products. An order can only have one product, but one product can be associated to several orders.
This is the structure of our data (this is called the schema):
Customers, Orders, Products are called tables. This is a very simple structure and in practice you’ll have much more tables: stocks, items (an order could have several items in it), etc
We’ve talked about one to many relationships. Customers and Products have a many to many relationships (N:N). Indeed, a customer can have several products, a product can be ordered by several customers.
Simply, a relational database will store data the way we just described but compared to a spreadsheet will be able to store much more data.
2/ How can you access and use the data stored in your database?
You’ve probably already heard about SQL and maybe it sounds like something complex. SQL stands or Structured Query Language and is a straightforward way to query data from your database.
This is not intended in anyway to be a SQL course, but we want to convey the message that starting with SQL is not hard at all. If you wanted to get all records from the customers database, you’d just have to write
SELECT * from CUSTOMERS
* basically stands for all
If you wanted only the email of customers:
SELECT Email FROM CUSTOMERS.
3/ How it can help you become a workplace hero
If you’ve read this article, you already are in the top 5% of your company in terms of understanding databases :)
Understanding how a database works and the basics of SQL can help you do tons of things that will help you perform better
- Being able at any point to query the data point you need to make a data driven decision
- Automate dashboards, you could for example connect your database to Excel and generate live dashboards instead of having to extract data manually each time you want to refresh your dashboards.
- Understanding better how your business works
We hope it helped.
For a more indepth article on relational databases, check out this article on 365 Data Science
You have questions? Feel free to comment below!