Skip to content
hostcomplex

What Is SQL

Maarten Soetens 3 min read

What SQL Does and Where It Is Used

What is SQL? SQL, short for Structured Query Language, is the standard language for working with relational databases. Applications and people use it to ask questions about data and to change that data.

SQL is a declarative language, which means you describe the result you want, such as the names of customers in Berlin, and the database engine works out how to retrieve it. A general-purpose programming language, by contrast, requires you to spell out each step.

SQL sits behind content management systems, online shops, accounting packages and reporting tools that store data in relational databases. Even when an application hides the database behind another layer of code, the requests that reach the database are usually SQL statements.

The Core Commands for Reading and Changing Data

Most SQL work uses a small set of commands. The four most common are:

  • SELECT reads data from one or more tables.
  • INSERT adds new rows.
  • UPDATE changes values in existing rows.
  • DELETE removes rows.

Together, these are called data manipulation language, or DML. A short example shows the idea: SELECT name FROM customers WHERE city = 'Berlin'; asks for the names of customers whose city is Berlin. Combining several tables in one query is covered in SQL joins.

A second group, data definition language, or DDL, creates and changes the structure itself. Commands such as CREATE TABLE, ALTER TABLE and DROP TABLE define tables, change their columns and remove them. A third group, data control language, or DCL, handles permissions with commands such as GRANT and REVOKE.

SQL Dialects and Why Syntax Varies

The SQL standard is published by international standards bodies, and it defines a common core that most relational databases support. Each product adds its own extensions, functions and data types, which are called dialects. Microsoft SQL Server uses T-SQL, Oracle Database adds PL/SQL for procedural code, and MySQL and PostgreSQL each have their own extensions.

A basic SELECT usually works across systems. A query that depends on vendor-specific date functions, text handling or the way results are paginated may need changes when it is moved. This is one reason the choice of database matters for long-term maintenance. The difference between the language and one specific product is explained in SQL vs MySQL.

Frequently asked questions

Is SQL a programming language?

SQL is usually called a query language or database language rather than a general-purpose programming language. It cannot build user interfaces or run general application logic on its own, but it is essential for working with data. Many databases add procedural extensions, such as stored procedures, that include programming features.

What is the difference between DDL and DML?

DDL, or data definition language, defines the structure of a database, such as creating tables and columns. DML, or data manipulation language, works with the data inside those structures, using commands such as INSERT, UPDATE and DELETE. SELECT is often grouped under DML, although some references treat it as a separate category called DQL.

  • Two-Factor Authentication

    Two factor authentication hosting adds a second check to control panel, domain and CMS logins. Learn which methods are strongest and why 2FA helps.

  • What Is an A Record?

    What is an A record? Learn how this DNS record maps a hostname to an IPv4 address, why domains use several A records and the root and www pattern.

  • Billing and Automation Platforms

    What is WHMCS? Learn how this commercial billing and automation platform helps hosts sell plans, collect payments and create accounts automatically.