Skip to main content

Posts

DATABASE DESIGN & NORMALIZATION

  Database Design and Normalization Introduction Good database design is crucial for efficient data management and retrieval Normalization is a technique used to design good table structures Goals of normalization: Minimize data redundancy Ensure data consistency Simplify data maintenance Avoid anomalies in data operations (insertion, deletion, update) Problems with Unnormalized Tables 1. Repetition Anomaly Definition: Unnecessary repetition of data across multiple rows Example: Repeating project details (Project_id, Project_name) for each employee working on the project Consequences: Wastes storage space Slows down data retrieval Increases risk of data inconsistencies 2. Insertion Anomaly Definition: Difficulty in inserting certain data without including other, potentially unavailable data Example: Unable to add a new employee without assigning them to a project Consequences: Limits flexibility in data entry May lead to incomplete or inaccurate data ...

Horizontal Scaling VS Vertical Scaling in Database Systems

  Vertical vs. Horizontal Scaling Introduction Scaling is the process of increasing a system's capacity to handle more load. There are two main types of scaling: vertical and horizontal. Vertical Scaling (Scaling Up) Definition: Vertical scaling involves adding more resources (like CPU, RAM, or storage) to a single existing machine. Key Points: Increases the power of a single machine Easier to implement Has a limit (the maximum capacity of a single machine) Example: Imagine your computer is struggling to run multiple programs at once. Vertical scaling would be like: Adding more RAM (from 8GB to 16GB) Upgrading the CPU (from dual-core to quad-core) Installing a faster SSD Real-world Analogy: It's like replacing a small moving truck with a larger, more powerful truck to handle more goods. Horizontal Scaling (Scaling Out) Definition: Horizontal scaling involves adding more machines to your system to share the load. Key Points: Distributes load across mult...

ACID PROPERTICES in DATABASE MANAGEMENT SYSTEMS

  What is ACID? ACID is an acronym that stands for Atomicity, Consistency, Isolation, and Durability. These properties ensure reliable processing of database transactions. The ACID Properties  1. Atomicity Definition : All operations in a transaction succeed or they all fail. Key Point : It's all or nothing. Example : Transferring $100 from Account A to Account B: Deduct $100 from Account A Add $100 to Account B If either step fails, the entire transaction is rolled back. 2. Consistency Definition : The database remains in a consistent state before and after the transaction. Key Point : All rules and constraints are enforced. Example : Rule: Account balance cannot be negative Initial balance of Account A: $50 Attempt to withdraw $100 from Account A Transaction will fail to maintain consistency 3. Isolation Definition : Multiple transactions can occur concurrently without interfering with each other. Key Point : Transactions appear to be executed sequ...

Introduction to Database

  Database Design:  1. Introduction to Databases  Definition of a database A database is an organized collection of structured information or data, typically stored electronically in a computer system. Example: Consider a university's student management system. This database might contain: Student personal information Course details Enrollment records Grades Students Table: StudentID | Name | DateOfBirth | Major 1001 | John Doe | 1999-05-15 | Computer Science 1002 | Jane Smith| 2000-03-22 | Biology Courses Table: CourseID | CourseName | Credits CS101 | Intro to Programming| 3 BIO201 | Cell Biology | 4 Enrollments Table: EnrollmentID | StudentID | CourseID | Semester | Grade 1 | 1001 | CS101 | Fall 2023 | A 2 | 1002 | BIO201 | Fall 2023 | B+ Importance of databases in modern computing Data Organization: Databases structure information logically. Data Retrieval: They allow quick a...

Modules, Packages and Library in Python

  Modules and Packages in Python In Python, both packages and modules are used for organizing and structuring code, but they serve different purposes. A module is a single file that contains Python code . It can define functions, classes, and variables that can be used in other parts of the code. You can import a module into another module or into the Python shell using the import statement. A package is a collection of modules . It is a directory that contains a special file called __init__.py which tells Python that the directory should be treated as a package. A package can contain other packages or modules, which can be imported in a similar way to modules.   key differences between packages and modules: ·          A module is a single file, while a package is a directory that can contain multiple files (modules). ·          Modules are used to organize code within a single file...