How To Use SQL


Series Description

Structured Query Language — commonly known as SQL — is a language used to define, control, manipulate, and query data held in a relational database. SQL has been widely adopted since it was first developed in the 1970s, and today it’s the predominant language used to manage relational database management systems.

Ideal for managing structured data (data that can fit neatly into an existing data model), SQL is an essential tool for developers and system administrators in a wide variety of contexts. Also, because of its maturity and prevalence, candidates with SQL experience are highly sought after for jobs across a number of industries.

This series is intended to help you get started with using SQL. It includes a mix of conceptual articles and tutorials which provide introductions to various SQL concepts and practices. You can also use the entries in this series for reference while you continue to hone your skills with SQL.

Note: Please be aware that the tutorials in this series use MySQL in examples, but many RDBMSs use their own unique implementations of SQL. Although the commands outlined in this tutorial will work on most RDBMSs, the exact syntax or output may differ if you test them on a system other than MySQL.

  • This conceptual article outlines the history of the relational model, how relational databases organize data, and how they're used today.
  • September 10, 2020
    Relational database management systems allow you to control what data gets added to a table with constraints. A constraint is a special rule that applies to one or more columns — or to an entire table — that restricts what changes can be made to a table's data. This article will go over in detail what constraints are and how they're used in relational databases. It will also walk through each of the five constraints defined in the SQL standard and explain their respective functions.
  • Tables are the primary organizational structure in SQL databases. They consist of any number of columns, which reflect individual attributes of each row, or record, in the table. Being such a fundamental aspect of data organization, creating and managing tables are common tasks for anyone who builds or maintains databases. This guide outlines how to create tables in SQL, as well as how to modify and delete existing tables.
  • September 3, 2020
    When designing an SQL database, there may be cases where you want to impose restrictions on what data can be added to certain columns in a table. SQL makes this possible through the use of constraints. After applying a constraint to a column or table, any attempts to add…
  • August 24, 2020
    SQL provides a great deal of flexibility in terms of how it allows you to insert data into tables. You can specify individual rows of data with the VALUES keyword, copy entire sets of data from existing tables with SELECT queries, as well as define columns in ways that will cause SQL to insert data into them automatically. In this guide, we'll go over how to employ each of these methods to load tables with data using SQL's INSERT INTO syntax.
  • September 25, 2020
    When working with a database, there may be times when you need to change data that's already been inserted into it; you may need to correct a misspelled entry, or perhaps you have information to add to an incomplete record. SQL provides the UPDATE statement which allows users to change existing data in a table. This guide outlines how you can use SQL's UPDATE syntax to change data in one or more tables. It will also explain how SQL handles UPDATE operations that conflict with foreign keys.
  • August 28, 2020
    As the name implies, DELETE operations irreversibly delete one or more rows of data from a database table. Being such a fundamental aspect of data management, it's important for SQL users to understand how the DELETE statement behaves and how it deletes data. This guide will go over how to use SQL's DELETE syntax to delete data from one or more tables. It will also explain how foreign key constraints handle DELETE operations.
  • Like many computer languages, SQL allows the use of various wildcard characters. Wildcards are special placeholder characters that can represent one or more other characters or values. This is a convenient feature in SQL, as it allows you to search your database for your data without knowing the exact values held within it. This tutorial will go over how to query data using SQL's designated wildcards.
  • October 15, 2020
    Many database designs separate information into different tables based on how certain data points relate to one another. Even in cases like this, it's likely that there will be times when someone will want to retrieve information from more than one table at a time. A common way of accessing data from multiple tables in a single SQL operation is to combine the tables with a JOIN clause. This guide outlines how to retrieve data from multiple tables by joining them together.