Skip to content
BENIBIX Learn

Structured Query Language (SQL)

Development🗃️ DatabasesDatabase Basics

Also known as SQL, Sequel

A code to ask a database for data. You use it to change data too.

Think of it like

Think of it like a clear note to a book shop. Find all books by this writer, oldest first.

Example

Emma wants every customer in London. She types one line of SQL, and the database returns the list.

Why it matters

SQL has been the way to work with data for 50 years. Developers and analysts both use it every day.

Definition

SQL is the language used to talk to relational databases. You use it to create tables, add rows, change them and ask questions of the data. A question in SQL reads almost like English, such as SELECT name FROM customers. The database works out the fastest way to answer it. PostgreSQL, MySQL and SQLite all speak SQL, each with small differences.

Example code

sql
SELECT name, city FROM customers WHERE city = 'London';
-- Emma | London
Ask for two columns, but only the rows where the city is London.

Common mistake

Building SQL by gluing in text a user typed. That opens the door to SQL injection; use parameters instead.

Key takeaways

  1. 1
    Say what, not how. The database picks the way.
  2. 2
    Reads like English. SELECT, FROM, WHERE.
  3. 3
    One language, many databases. Small dialects, same core.