What a Database Does for Your Business Website
Customers, orders, bookings and products all live in a database. Learn in plain words how it works, what SQL and PHP do, and how to keep the data safe.
Every time a customer fills in your contact form, books an appointment, creates an account or buys something on your website, that information has to be kept somewhere. It cannot live in the page itself, because the page is the same for every visitor. It goes into a database.
You will probably never look at your database directly, and that is fine. But knowing what it does helps you ask better questions, understand quotes, and spot the risks before they turn into a bad day. This article explains it in plain words.
What is a database, really?
Think of a database as a set of very well organized spreadsheets that a computer can search in a fraction of a second.
Each spreadsheet is called a table. A small online store might have a table for customers, one for products and one for orders. Each row is one record, such as one customer, and each column is one detail about it, such as the name, the email or the phone number.
The clever part is how the tables connect. An order does not copy the customer’s name and address into itself. It simply points to the customer’s row. That way, when a customer updates their address, every order that belongs to them stays correct. Databases built this way are called relational databases, and they have been the backbone of business software for decades.
SQL: the language for asking questions
To read or change the data, programs use a language called SQL, short for Structured Query Language. It was developed in the 1970s, and it is still the standard way to talk to a relational database today.
SQL reads almost like an English sentence. A request to the database might say, in effect: “Select the name and phone number of every customer whose city is Miami.” Another might say: “Add this new order for this customer, with these three products.” The database answers in a fraction of a second, even with many thousands of rows.
You do not need to write SQL yourself. Your website, your online store or your admin screens write it for you every time someone clicks a button.
The database systems you will hear about
There are several database systems, and they all speak SQL with small differences. These are the names you are most likely to see on a quote:
- MySQL. First released in 1995 and one of the most widely used databases on the web. WordPress and WooCommerce store everything in MySQL or its close relative, MariaDB.
- MariaDB. A version of MySQL started in 2009 by MySQL’s original creator. Many hosting companies use it in place of MySQL, and to a WordPress website the two behave the same way.
- PostgreSQL. Its roots go back to a university research project in the 1980s, and it is known for being strict about data and rich in features. The customer portals and online tools we build store their data in PostgreSQL through a service called Supabase.
None of these is “the best” in every case. What matters more is how the database is set up, protected and backed up.
Where PHP and other server code fit in
A visitor’s browser never talks to the database directly. That would be like letting every customer walk into your back office and open the filing cabinet. Instead, there is a layer of code on the server in between.
On a WordPress website, that code is written in PHP, a programming language created in the mid-1990s that still runs a very large share of the web. When someone opens a product page, PHP asks the database for that product, builds the page, and sends it to the browser. When someone submits an order, PHP checks the details and writes the order into the database.
Other websites use different server code, such as small server functions written in JavaScript or TypeScript, but the job is the same: stand between the public and the data, check every request, and only allow what should be allowed.
Why the database is the part attackers want
Your design can be copied and your text can be rewritten, but your customer list, your orders and your account passwords are the valuable part. That makes the database the main target of many attacks.
The best known attack is called SQL injection. If the server code takes what a visitor types into a form and pastes it straight into a SQL request, a clever attacker can type a piece of SQL instead of their name and trick the database into handing over data it should not. The fix is well known: the server code must send what visitors type as plain data, never as part of the command. Modern tools do this by default, but old custom code and poorly written plugins sometimes do not.
Other everyday risks are less dramatic but just as real:
- Too much access. Every program that connects to the database should be able to do only what it needs. A contact form does not need permission to delete your customer list.
- Old software. WordPress, its plugins, PHP and the database system all receive security updates. A website that has not been updated in a year is running known holes.
- Weak passwords on admin accounts. If someone can log in as an administrator, they do not need to break into the database at all.
On the portals and tools we build, the database itself enforces who can see what. These rules, called row level security, mean that even if a request reaches the database, a customer can only read their own rows. The protection does not rely on the website code alone.
Backups: the difference between a bad day and a disaster
Hardware fails, updates go wrong and people delete the wrong thing. A database without a good backup is one mistake away from losing years of customers and orders.
A good backup plan answers three questions:
- How often? For a store or a booking website, at least once a day, because a day of orders is a lot to lose.
- Where? In more than one place, including at least one copy away from the server itself, so a problem with the server cannot take the backups with it.
- Has anyone tried restoring it? A backup that has never been restored is a hope, not a plan. Test restores prove the copy is complete and that you know how long getting it back takes.
Our Web Hosting + plan includes daily backups, restored the same day if needed.
Speed: why some databases make websites slow
A database is fast, but it can be asked to do too much. A WordPress website with many plugins can send dozens of database requests to build a single page, for every visitor. Under load, that adds up.
The usual fixes are good indexes, which work like the index in the back of a book so the database can find rows without reading every one; caching, which keeps finished pages ready so the database is not asked the same question again and again; and cleaning out data that piles up over the years, such as old drafts, expired sessions and leftovers from plugins that were removed long ago.
Questions to ask whoever looks after your website
- Which database does my website use, and who has access to it?
- How often is it backed up, where are the copies kept, and when was a restore last tested?
- Are WordPress, the plugins, PHP and the database system up to date?
- Do admin accounts use strong passwords and two-step sign-in?
- If my website went down today, how long would it take to bring back, data and all?
If the answers are vague, that tells you something too. Our free website security check gives you a security grade for your website in under a minute, and our website security services cover the rest.
The takeaway
The database is the part of your website that remembers. It holds the customers, orders and bookings that your business runs on, it is reached through server code such as PHP, it speaks SQL, and it is the part attackers want most. Keep it updated, give every program only the access it needs, back it up every day to more than one place, and test that the backups really restore.
If you would like a website or an online store built with that in mind from day one, see what we build or ask us a question. We answer in plain English, with a fixed price agreed before we start.








