Microsoft Docs

Getting Started with Relational Databases

Overview

This guide introduces the fundamental concepts of relational databases and walks you through the steps needed to set up SQL Server, create your first database, and run basic queries.

Prerequisites

Install SQL Server

  1. Download the SQL Server installer.
  2. Run the installer and select Basic installation.
  3. Follow the prompts to complete the installation.

After installation, verify the service is running:

net start MSSQLSERVER

Create a Database

Open SQL Server Management Studio (SSMS) and connect using Windows Authentication.

Run the following script to create a sample database:

CREATE DATABASE SampleDB;
GO
USE SampleDB;
GO

Basic Queries

Create a simple table and insert data:

CREATE TABLE Employees (
    EmployeeID INT PRIMARY KEY IDENTITY,
    FirstName NVARCHAR(50),
    LastName NVARCHAR(50),
    HireDate DATE
);
GO

INSERT INTO Employees (FirstName, LastName, HireDate) VALUES
('Alice', 'Smith', '2022-01-15'),
('Bob', 'Johnson', '2021-07-30');
GO

Query the data:

SELECT * FROM Employees;
GO

Next Steps

Explore Advanced Topics