Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 39 ยท Getting Started

Introduction to SQL Server

Learn what Microsoft SQL Server is, how its engine, editions and T-SQL fit together, and how to read your first query before installing anything.

Microsoft SQL Server is a relational database management system (RDBMS). You store data in tables, ask questions with SQL, and the server decides how to find the answer quickly, keeps the data safe when several people write at once, and survives crashes without losing committed work. It has been around since the late 1980s, runs on Windows, Linux and in containers, and is also offered as a cloud service (Azure SQL Database and Azure SQL Managed Instance). You will meet it in banks, hospitals, online shops, government systems and a great many internal business applications, especially wherever .NET is used.

This course teaches SQL Server from the first query to indexing, security and real projects. The language you write is T-SQL (Transact-SQL): standard SQL plus Microsoft extensions such as variables, TOP, stored procedures and error handling. If you already know basic SQL from the SQL tutorial, many things will look familiar; the lessons point out where T-SQL differs.

How the examples run. SQL Server itself cannot run in your browser. Examples written in pure standard SQL run live in the editors on this page. T-SQL-only features (TOP, variables, GO, procedures) are shown as read-only code blocks, and next to them you get a runnable stand-in that does the same job in a portable dialect. Each stand-in is labelled, so you always know what is real T-SQL and what is the stand-in.

What the server does for you

A SQL Server installation is called an instance. One instance can hold many databases, and each database holds tables, views, indexes, procedures and other objects. When a client such as SSMS or an application sends a query, the instance parses it, builds an execution plan, reads the data (from memory if possible, otherwise from disk), and sends rows back.

flowchart LR
  A["Client<br/>(SSMS, app, sqlcmd)"] --> B["Protocol layer<br/>(TDS over TCP)"]
  B --> C["Query processor<br/>(parse, optimize, execute)"]
  C --> D["Storage engine<br/>(buffer pool, locks, log)"]
  D --> E["Data files .mdf/.ndf"]
  D --> F["Transaction log .ldf"]

The path of a query: network, query processor, storage engine, files on disk.

Three ideas explain most of the behavior you will see later:

  • The query processor is declarative. You say what you want; the optimizer picks how. Two queries that return the same rows can run at very different speeds, which is why indexes and execution plans get a whole chapter later in this course.
  • The transaction log guarantees durability. Every change is written to the log before the data pages are considered safe. After a crash, SQL Server replays committed work and undoes unfinished work.
  • Pages are the unit of storage. Data lives in 8 KB pages held in memory (the buffer pool). Reading a page from memory is thousands of times faster than reading it from disk.

Editions and versions

SQL Server comes in editions that differ in limits and features, not in the language you write:

Edition Typical use
Developer Free, full-featured, for development and testing only (not production)
Express Free, for small apps; limited to 10 GB per database and small memory use
Standard Production workloads on a budget
Enterprise Large production systems: advanced availability, compression, partitioning, online operations
Web Public web hosting (licensed through providers)

Versions are named by year: 2017, 2019, 2022, 2025. A newer version adds features (for example STRING_AGG arrived in 2017, GENERATE_SERIES and DATE_BUCKET in 2022). A database also has a compatibility level that controls which language and optimizer behaviors it uses. This course targets SQL Server 2022 and mentions older versions where a feature is recent.

A first look at T-SQL

Here is a complete T-SQL batch. You do not need to run it; just read it.

SQL
SELECT TOP (3) name, price
FROM dbo.products
WHERE price > 20
ORDER BY price DESC;

Three T-SQL details stand out. TOP (3) limits rows (other systems use LIMIT). dbo is a schema, a namespace inside the database; dbo is the default one. Keywords are case-insensitive, and the statement ends with a semicolon, which is optional in many places but strongly recommended.

The editor below runs the portable stand-in for that query against a small shop database. It uses LIMIT where T-SQL uses TOP.

SQL Stand-in: the first query ยท database: shop

Press Run (or Ctrl + Enter) to see the result here.

Most of the SQL you write, such as SELECT, WHERE, JOIN, GROUP BY and INSERT, is identical everywhere. Try an aggregate; this exact statement works unchanged in SQL Server:

SQL Standard SQL aggregate ยท database: shop

Press Run (or Ctrl + Enter) to see the result here.

The SQL Server ecosystem

SQL Server is more than the database engine. Common companions are:

  • SSMS (SQL Server Management Studio) and Azure Data Studio: graphical tools for writing queries and administering servers (see Installing SQL Server and its tools).
  • SQL Server Agent: schedules jobs such as backups and nightly loads.
  • SSIS, SSRS, SSAS: Integration (ETL), Reporting and Analysis Services for data movement, reports and analytical cubes.
  • sqlcmd and PowerShell: command-line tools for scripts and automation.

Common beginner mistakes

  • Assuming T-SQL equals standard SQL. Features like TOP, @@ROWCOUNT and GO only exist in T-SQL.
  • Treating Express as unlimited. Its size limit is enforced; plan for it.
  • Developing against the Developer edition and deploying to Standard without checking that every feature you used exists in Standard.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is T-SQL?

    T-SQL (Transact-SQL) is standard SQL plus Microsoft extensions such as variables, TOP and procedural control flow.
  2. 2. Which component guarantees that committed changes survive a crash?

    Changes are written to the transaction log first; after a crash, SQL Server replays committed work from it.
  3. 3. What does an instance of SQL Server contain?

    One instance hosts many databases, and each database contains its own tables, views, procedures and other objects.
  4. 4. Which edition is free for development and testing but not allowed in production?

    Developer has the full feature set of Enterprise but may not be used for production workloads. Express is free for production but limited in size.

Summary

  • SQL Server is Microsoft's relational database system; T-SQL is its SQL dialect.
  • An instance hosts databases; a database holds schemas and objects such as tables and views.
  • The optimizer chooses how to run your declarative query; the transaction log provides durability.
  • Editions change limits and features, not the language; this course targets SQL Server 2022.
  • Standard SQL runs live on this site; T-SQL-only features come with labelled stand-ins.

Next: Installing SQL Server and its tools