SQL Basics
The foundation behind every query
SQL lets you describe data structures, add and change records, and retrieve the rows you need from tables. Before moving on to filtering, grouping, and joins, it is important to understand the building blocks of the language and how a database represents data.
In this section, we will build the foundation: SQL syntax, data types, commands that change database structure and contents, your first query with SELECT, constraints, and keys. We will also look at NULL separately, because a missing value in SQL does not behave like an ordinary value.
What this section contains
- SQL syntax. We will look at how SQL statements are structured, how keywords are used, and the basic rules for writing queries.
- Data types. We will understand what kinds of values columns can store and why choosing the right type matters for correctness and later data processing.
- DDL. We will learn how to create and change database structures.
- DML. We will cover operations for inserting, updating, and deleting rows.
- SELECT. We will make our first complete query that reads data from a table.
- Constraints. We will see how the database itself can enforce important rules for stored values.
- Primary Key and Foreign Key. We will understand how to identify rows uniquely and connect tables to each other.
- NULL. We will examine the special state that represents the absence of a known value.
These topics connect directly: first we learn to describe a table, then to place valid data into it, and only after that to read it confidently. With this foundation in place, we can later add conditions, sorting, and more complex result processing.