SQL SQL

SQL is the language software uses to ask a database a question, so every sales report you read on screen is an SQL question asked on your behalf.

Also known as Structured Query Language database query language SQL queries

Definition

SQL is the language people use to ask a database a question, so you write the question and the database finds the answer. A shop owner never types it, yet every sales report on the screen is an SQL question underneath, asked by the software on their behalf.

What makes SQL unusual is that you describe the answer you want, not the steps for finding it. You ask for the ten customers who spent the most last month, and you never say how to look through the rows. The database works that part out itself, which is why the same few words can pull an answer out of ten records or ten million.

Here is the part that surprises owners. The same question can come back in half a second or in ten minutes, and a faster server rarely fixes it. Usually the database is missing an index, a small list it keeps on the side so it can jump straight to the right rows instead of reading every one. Adding one is a few minutes of work, so when Linkysoft is asked why a report has become slow, a missing index is the answer more often than anything else.

SQL has been in use since the 1970s and has barely changed. That is unusual in software and it works in your favour, because someone who learned it on MySQL can read the questions running inside a system built on PostgreSQL. It also means your data is not trapped, so ask a supplier for a full export of your own records before you sign. If the answer gets complicated, that is worth knowing early.

There is one danger worth naming, because if a website drops whatever a visitor typed straight into an SQL question, a stranger can change the question itself. That is called SQL injection, and it is still one of the most common ways a business loses customer data. It is prevented by the way the code is written, not by buying a product. So we check it on every web application we take over, and it is a fixed part of a Linkysoft security review. The reports you read in Storek are SQL questions someone wrote once, so nobody has to think about them again.

Questions about SQL

Do I need to learn SQL to run my business?
No. Your staff never see it. It is worth knowing the word, because when you ask for a new report, SQL is what someone writes to produce it, and that is usually a small job.
Is SQL the same thing as a database?
No. SQL is the language you ask questions in. MySQL, PostgreSQL and SQL Server are databases that understand it. One language, several products.
What is SQL injection and should I worry about it?
It is when a stranger types something into a form that changes the question your site asks the database. Written properly, the code makes it impossible. It is a coding habit, not a product you buy.
Can I take my data with me if I change supplier?
Usually yes, because an SQL database exports cleanly. Ask for a sample export in writing before you sign, not after the relationship has gone sour.

Still not sure how this applies to your project?

Tell us what you are building and we will answer in plain language.