SQL - Introduction

Overview

Estimated time: 20–30 minutes

Structured Query Language (SQL) is the standard language for working with relational databases. In this course you will learn SQL from first principles to advanced topics with complete examples across three popular engines: MySQL, SQL Server, and SQLite.

Learning Objectives

  • Understand what SQL is and where it’s used.
  • Know the main sub-languages: DDL, DML, DQL, DCL, TCL.
  • Recognize differences and commonalities between MySQL, SQL Server, and SQLite.
  • Run your first queries safely.

What you will be able to do

  • Design schemas: tables, constraints, relationships.
  • Query data: selects, filters, joins, aggregations, window functions.
  • Modify data: inserts, updates, deletes, upserts/merge.
  • Program database-side logic: views, procedures, functions, triggers.
  • Operate safely: transactions, isolation, locking, permissions.
  • Optimize: indexing basics, query plans and EXPLAIN.

Your first query

-- select current date/time
SELECT NOW();
-- select current date/time
SELECT SYSDATETIME();
-- select current date/time (UTC)
SELECT datetime('now');

Common SQL Flavors

  • MySQL: ubiquitous open-source server; great for web apps.
  • SQL Server: enterprise-grade with rich T-SQL features.
  • SQLite: serverless, embeddable; excellent for apps/tests.

Safety tips

  • Practice on a sandbox database. Avoid running destructive commands on production.
  • Use transactions when experimenting: BEGIN → try → ROLLBACK.