--:-- --
↓ Scroll for more

Relational Databases and SQL

ICT 110: IT for Business

Today's Roadmap πŸ—ΊοΈ

We will move from the general concept of a DBMS to the specifics of how businesses organize and query data.

  • βœ… DBMS Types: When to use SQL vs. NoSQL.
  • βœ… The Relational Model: Tables, Keys, and Relationships.
  • βœ… SQL Basics: Speaking the language of data.
  • βœ… Big Data: Handling volume, velocity, and variety.
  • βœ… Business Application: Real-world examples from Nepal.

Types of DBMS: SQL vs. NoSQL

Relational (SQL)

Organizes data in structured tables with predefined relationships, like linked spreadsheets.

Schema: Rigid, defined in advance.

Best for: Transactional systems, strict consistency (Banking, Inventory).

Examples: MySQL, Oracle, SQL Server

NoSQL ("Not Only SQL")

Flexible models for unstructured or rapid data.

Schema: Dynamic.

Best for: Big Data, real-time apps, content management (Social Media).

Examples: MongoDB, Cassandra

The Relational Model: Organizing Data Logically

A relational database stores data in tables that are related to one another.

  • Tables (Relations): Collections of related data objects (e.g., `Employees`, `Orders`).
  • Rows (Records): A single entry. (e.g., One specific employee).
  • Columns (Attributes): A specific piece of distinct info. (e.g., `Name`, `Salary`).
  • Primary Key πŸ”‘: A unique identifier for each row. (e.g., `EmployeeID`).
  • Foreign Key πŸ”—: A field linking to another table's Primary Key.

Visualizing the Relationship 🀝

An HR Example: Employees and Departments

Table: DEPARTMENTS

Dept_ID (PK) πŸ”‘ Dept_Name
101 Finance
102 Operations

Table: EMPLOYEES

Emp_ID (PK) πŸ”‘ Name Dept_ID (FK) πŸ”—
E451 Anjali Sharma 101
E452 Bikram Thapa 102

The `Dept_ID` connects the employee to their department, minimizing redundancy.

Speaking the Language of Data: SQL πŸ”

SQL (Structured Query Language) is the standard language for manipulating relational databases.

The four main actions (CRUD):

  • SELECT: Retrieve data (Read) -> Most common for business reporting!
  • INSERT: Add new data (Create)
  • UPDATE: Modify existing data (Update)
  • DELETE: Remove data (Delete)

Asking a Business Question with SQL

Scenario: A Sales Manager asks, "Show me the names and order amounts for all customers from Pokhara."



SELECT CustomerName, OrderAmount
FROM Customers
JOIN Orders ON Customers.CustomerID = Orders.CustomerID
WHERE Customers.City = 'Pokhara';
    
  • SELECT...FROM: Pick columns (`Name`, `Amount`) and tables (`Customers`, `Orders`).
  • JOIN...ON: Connect the tables using the `CustomerID`.
  • WHERE: Filter the results (City = 'Pokhara').

Beyond Traditional Databases: Big Data ⚑

When data is too large, fast, or complex for standard SQL tables.

Volume

Size.
Terabytes of data (e.g., Ncell logs).

Velocity

Speed.
Real-time streams (e.g., Pathao).

Variety

Types.
Images, video, text (e.g., Reviews).

Big Data analytics uncovers hidden patterns for strategic decisions.

DBMS in Action: Nepali Industries

FinTech (eSewa)

Core: Relational (SQL)
Critical for processing millions of transactions with 100% accuracy and security (ACID compliance).

E-commerce (Daraz)

Hybrid: SQL + NoSQL
SQL for order processing; NoSQL for massive, flexible product catalogs and user reviews.

Manufacturing (CG Corp)

Enterprise: ERP Systems
Relational databases manage complex supply chains, from raw materials to distribution.

Telecom (NTC/Ncell)

Big Data
Analyzing call records and usage patterns to optimize network coverage and plan pricing.

Data Security & Ethics πŸ›‘οΈ

Protecting the corporate asset is non-negotiable.

  • Confidentiality (Privacy): Access controls ensure only authorized staff see sensitive data (e.g., salaries).
  • Integrity (Accuracy): Constraints prevent invalid data entry (e.g., negative prices).
  • Availability: Redundancy and backups ensure data is there when business needs it.

Thank You

Any questions about Databases or SQL?


Back to Start

Next Topic