HexLibraryHexLibrary
</> HexCodeSign inSign up
PythonJavaScriptTypeScriptCC++JavaPHPGoRustRubyBashSQLLuaPerlCOBOLPascalDelphiFortranDartSwiftC#JuliaGroovyRElixirHaskellKotlinScalaClassic ASPClipperMS-DOS
LESSONS
Introduction to SQL (SELECT)Tables (CREATE & INSERT)Filtering (WHERE)Sorting & LimitingAggregate FunctionsUpdate & DeleteJoins (JOIN)
REFERENCE
📖 Overview
🔎 Querying (SELECT)
🗃️ Creating a Table
✏️ Inserting & Modifying Data
🧲 Filtering (WHERE)
🔢 Sorting & Limiting
📊 Aggregate Functions
🔗 Joins (JOIN)

SQL lessons

Database querying

SQL does something different from other languages: you tell the computer what you want, not how to do it. You say "Bring me the rows from this table that match this condition in this order"; the database decides which file to read and in what order. This is called a declarative language.

SQL is not a programming language, it is a query language; you don't write loops and draw things on the screen. On the other hand, it appears everywhere data exists: MySQL, PostgreSQL, SQL Server, Oracle, and SQLite all speak SQL. Although there are minor syntax differences between them, SELECT, INSERT, UPDATE, and DELETE are the same everywhere.

Knowing SQL is a skill beyond software development: data analysts, marketers, product managers, and testers also use SQL to generate reports. In most job postings, SQL is expected regardless of language preference.

📖 Command Reference→
  • •

    Introduction to SQL (SELECT)

    The basics of database querying: fetching data and creating tables with SELECT.

    →
  • •

    Tables (CREATE & INSERT)

    Defining tables with CREATE TABLE and inserting data with INSERT.

    →
  • •

    Filtering (WHERE)

    Selecting rows based on conditions with WHERE, comparisons, AND/OR, and LIKE.

    →
  • •

    Sorting & Limiting

    Sorting with ORDER BY (ASC/DESC) and limiting the number of results with LIMIT.

    →
  • •

    Aggregate Functions

    Summarizing with COUNT, SUM, AVG, MIN, MAX, and GROUP BY.

    →
  • •

    Update & Delete

    Updating records with UPDATE and deleting with DELETE (the importance of WHERE).

    →
  • •

    Joins (JOIN)

    Combining two tables on a common column and querying them together.

    →

What you will learn

  • Selecting columns with SELECT and filtering rows with WHERE
  • Sorting and trimming the result with ORDER BY and LIMIT
  • Aggregate functions like COUNT, SUM, AVG and the GROUP BY logic
  • Joining multiple tables with JOIN
  • Modifying data with INSERT, UPDATE, and DELETE
  • Designing tables and setting basic constraints with CREATE TABLE

Who is this for?

  • Anyone doing data analysis or reporting — being a developer is not required
  • Backend developers who talk to the database
  • Candidates who will face SQL questions in job interviews

When to use?

SQL is required in every job working with relational data: generating reports, filtering user lists, getting sales totals, joining two tables. A single well-written query is both shorter and faster than a hundred lines of code doing the same thing.

For schemaless, rapidly changing data structures or very large-scale document storage, non-SQL systems like MongoDB can be preferred. Still, most of these systems today offer a query interface similar to SQL.

Frequently asked questions

Is SQL a programming language?

Technically no; SQL is a declarative query language, not designed for general-purpose programming. You define what you want, and the database engine decides how to fetch it. However, thanks to conditions, functions, and subqueries, quite complex logic can be built.

What is the difference between MySQL, PostgreSQL, and SQL?

SQL is the name of the language; MySQL and PostgreSQL are database systems that speak that language. The basic commands are the same in both; differences appear in date functions, text processing, and advanced features. Once you learn the fundamentals, changing systems is a minor adaptation issue.

What is the difference between INNER JOIN and LEFT JOIN?

INNER JOIN only returns rows that match on both sides. LEFT JOIN returns all rows from the left table; if there is no match on the right side, those columns come as empty (NULL). If you also want to list customers who have no orders, you need a LEFT JOIN.

Why can't I use COUNT inside WHERE?

Because WHERE runs before rows are grouped; COUNT is a value produced after grouping. HAVING is used to apply conditions to the grouped result. This is one of the most common error messages encountered while learning SQL.

Summary

SQL is the common language of everyone working with data, and once learned, it works across almost all database systems. In this training, we start with a simple SELECT and progress to grouping, JOINs, and table design.

HexLibraryHexLibrary

Learn programming more clearly. Every command is explained line by line with colors, reinforced with runnable exercises, test your code instantly — all in one place, free.

Learn

  • Home
  • Languages & Lessons
  • HexCode

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

Other Projects

  • HexToolz
  • Free Service Manuals
© 2026 HexLibrary · The clearest way to learn code