# a. Relational Databases (SQL)

**1. Basics of Relational Databases:**

* **Definition**: A relational database is a type of database that uses a structured way of organizing and storing data in tables. These tables are related to one another based on keys, typically primary and foreign keys.
* **Relational Model**: Proposed by E.F. Codd, this model is based on the concept of relation, which is essentially a mathematical term for table. The relational model ensures data integrity and accuracy through its set of integrity rules.

**2. Key Concepts:**

* **Tables (or Relations)**: Consist of rows and columns where each row represents a record and each column represents an attribute of the record.
* **Primary Key**: A unique identifier for a record in a table. No two records can have the same primary key value.
* **Foreign Key**: A set of one or more columns in a table that refers to the primary key of another table. It's used to establish relationships between tables.
* **Normalization**: The process of organizing data to reduce redundancy and improve data integrity. It involves dividing large tables into smaller ones and defining relationships between them.

**3. SQL (Structured Query Language):**

* **Definition**: SQL is the standard language for relational database management systems. It's used to create, maintain, query, and manipulate data.
* **SQL Operations**:
  * **DDL (Data Definition Language)**: Commands like CREATE, ALTER, DROP used to define or modify database structures.
  * **DML (Data Manipulation Language)**: Commands like SELECT, INSERT, UPDATE, DELETE used to manipulate data.
  * **DCL (Data Control Language)**: Commands like GRANT and REVOKE, which handle permissions.

**4. ACID Properties:**

* Ensures reliability of database transactions.
  * **Atomicity**: Ensures that all operations within a transaction are completed successfully; otherwise, the transaction is aborted.
  * **Consistency**: Ensures that a transaction brings the database from one valid state to another.
  * **Isolation**: Ensures that concurrent execution of transactions leaves the database in the same state as if the transactions were executed sequentially.
  * **Durability**: Ensures that once a transaction is committed, it remains so.

**Learning Resources:**

1. **Books**:
   * "Database System Concepts" by Abraham Silberschatz, Henry F. Korth, and S. Sudarshan.
   * "SQL Performance Explained" by Markus Winand.
2. **Online Courses**:
   * [Coursera: Introduction to Relational Database and SQL](https://www.coursera.org/learn/introduction-to-relational-database-and-sql)
   * [Udemy: The Complete SQL Bootcamp](https://www.udemy.com/course/the-complete-sql-bootcamp/)
3. **Websites**:
   * [SQLZoo](https://sqlzoo.net/): Interactive SQL tutorials.
   * [W3Schools SQL Tutorial](https://www.w3schools.com/sql/): A beginner-friendly guide to SQL.
4. **Interactive Platforms**:
   * [LeetCode](https://leetcode.com/): Offers SQL challenges to practice your skills.
   * [HackerRank](https://www.hackerrank.com/): Provides SQL challenges and tutorials.

I hope this provides a comprehensive understanding of relational databases. If you have any specific questions or need further resources on any of the topics mentioned, please let me know!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learn.heysushil.in/1.-database-knowledge-road-map/a.-relational-databases-sql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
