πŸ“š Introduction to Databases – A Beginner's Guide

Databases are everywhere! From your favorite social media app to online shopping platforms, databases store and manage all the data that powers these applications. In this article, we’ll go through some essential concepts every developer should know.


βœ… 1. Introduction to Databases

A database is an organized collection of data, generally stored and accessed electronically from a computer system.

Why do we need databases?

  • πŸ—„οΈ To store large amounts of data efficiently
  • ⚑ To retrieve data quickly
  • πŸ” To ensure security and consistency

Example:
Imagine an online shopping app. It needs to store:

  • User details πŸ‘€
  • Product details πŸ›οΈ
  • Orders and transactions πŸ’³

βœ… 2. Schema & Three-Layer Abstraction

The three-layer architecture helps in separating user interaction from the physical storage of data.

πŸ—οΈ Layers of Database Architecture

  • External Level: How users view the data
  • Conceptual Level: How data is logically organized
  • Internal Level: How data is physically stored

Example:
When you order food on an app:

  • You see menu items (External)
  • The app organizes menus, prices, and orders (Conceptual)
  • Data is stored in tables inside a database (Internal)

βœ… 3. ACID Properties

Databases must maintain data integrity. That’s where ACID properties come in:

  • A – Atomicity: All operations in a transaction succeed or none do
  • C – Consistency: Database remains in a valid state
  • I – Isolation: Multiple transactions do not affect each other
  • D – Durability: Once committed, changes are permanent

Example:
When transferring money:

  • Debit from one account βœ…
  • Credit to another βœ…
    Both should succeed together, or neither should happen.

βœ… 4. Installation of MS-SQL Server

To work with MS SQL Server, you need to:

  • Download and install SQL Server from Microsoft
  • Install SQL Server Management Studio (SSMS) for managing databases

πŸ’‘ Tip: Always choose the developer edition for learning.


βœ… 5. DDL Commands

DDL (Data Definition Language) commands are used to define and modify database structures.

✏️ CREATE Command

```sql CREATE TABLE Students ( StudentID INT PRIMARY KEY, Name VARCHAR(50), Age INT );

1
Subscribe to my newsletter

Read articles from 𝔏𝔬𝔳𝔦𝔰π”₯ π”Šπ”¬π”Άπ”žπ”© directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

𝔏𝔬𝔳𝔦𝔰π”₯ π”Šπ”¬π”Άπ”žπ”©
𝔏𝔬𝔳𝔦𝔰π”₯ π”Šπ”¬π”Άπ”žπ”©