← Back to Dashboard

Day 1: SQL Server Fundamentals

1. Introduction

Welcome to Day 1! Data is the backbone of almost every modern application, and SQL Server (developed by Microsoft) is one of the most powerful and widely used tools to manage it.

Today, we are laying the groundwork. We won't just learn how to write code; we will learn how data is structured. By the end of this session, you will know how to create a database from scratch, build tables to hold your data, and apply strict rules (constraints) to ensure your data stays accurate.

2. Database Concepts

Why Database?

Before databases, organizations stored data in flat files (like spreadsheets or text documents). While fine for personal use, traditional files fail when handling complex, real-world business applications. We use databases to solve these critical problems:

What is a Database?

A database is a systematic or organized collection of related information that is stored in such a way that it can be easily accessed, managed and updated.

Applications of Databases

Components of database:

Types of Databases:

Advantages of Databases:

3. DBMS vs Database

What is DBMS(Database Management System)?

A DBMS is software that helps manage a database.
It allows us to store, retrieve, and manipulate data efficiently.

Advantages of DBMS:

4. Database Languages

What is Database Language?

We need some special kind of programming languages to make the DBMS software understand our needs and manage the data stored in the databases accordingly. These programming languages are known as database languages or query languages.

Types of Database Languages

4. Database Operations

Creation, Alteration, Dropping

Single User Mode vs Multi-user Mode

In SQL Server, Single-User Mode (SINGLE_USER) is a maintenance-focused state that restricts access to only one person or process at a time, often used for critical administrative tasks like restoring the master database or performing schema repairs. When active, it terminates all other open connections, sometimes requiring the WITH ROLLBACK IMMEDIATE clause to force the closure of existing sessions. In contrast, Multi-User Mode (MULTI_USER) is the standard production state that allows multiple simultaneous connections, enabling concurrent data access and collaboration across an organization.

5. Table Operations & Constraints

Table Creation and Operation

[Provide syntax for CREATE TABLE, ALTER TABLE, DROP TABLE...]

Create Table

Insert data into table

Update data in a Table

Delete data in a Table

Truncate Table

DROP TABLE

Key points:

Constraints

Cascading Referential Integrity

In SQL Server, cascading referential integrity dictates what happens to child records when a parent key is updated or deleted. While the default behavior blocks these changes to prevent orphaned data, cascading rules automatically propagate the updates or deletions across all related tables.

When defining a Foreign Key in SQL Server, you can specify one of four behaviors for ON DELETE and ON UPDATE operations:

Implementation Methods SSMS

Navigate to the child table in Object Explorer.
Expand the Keys folder, right-click the foreign key, and select Modify.
In the Foreign Key Relationships window, expand INSERT And UPDATE Specification.
Set the Delete Rule or Update Rule to your desired action.