Skip to content

Commit

Permalink
Merge branch 'CodeHarborHub:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
W-ight authored Jun 8, 2024
2 parents 159f301 + 7e805dc commit 96a275e
Show file tree
Hide file tree
Showing 85 changed files with 12,327 additions and 17 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/issue_creation_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Issue Creation Workflow

on:
issues:
types: [opened]

jobs:
check-contributor-issues:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '14'

- name: Retrieve Contributors
run: |
CONTRIBUTORS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/contributors | jq -r '.[].login')
echo "::set-output name=contributors::$CONTRIBUTORS"
- name: Count Open Issues for Each Contributor
id: count-issues
run: |
for contributor in ${{ steps.retrieve-contributors.outputs.contributors }}; do
ISSUE_COUNT=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/search/issues?q=is:open+author:${contributor}+repo:${{ github.repository }}" | jq -r '.total_count')
echo "::set-output name=${contributor}_issue_count::$ISSUE_COUNT"
done
- name: Check Contributor's Open Issues Count
run: |
contributor=${{ github.event.issue.user.login }}
issue_count=${{ steps.count-issues.outputs["${contributor}_issue_count"] }}
if [ "$issue_count" -ge 4 ]; then
echo "Contributor $contributor has $issue_count open issues. Please complete your existing open issues before creating a new one."
exit 1
fi
Binary file added assets/KMP_algo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/LinearSearch_GFG.webp
Binary file not shown.
Binary file added assets/binnary-search-.webp
Binary file not shown.
Binary file added assets/knnclassifier.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/kthNearest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions docs/DBMS/Entity-Relational Model/_category.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"label": "Entity-Relational Model",
"position": 1,
"link": {
"type": "generated-index",
"description": "In this section, you will learn about the Entity-Relational Model in DBMS, a fundamental concept for conceptual design of databases. We will cover the basics of entities, relationships, attributes, and constraints, and how they are used to create a structured database schema."
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
id: dbms-generalization-and-aggregation
title: DBMS - Generalization and Aggregation
sidebar_label: Generalization and Aggregation
sidebar_position: 3
description: Learn about the concepts of Generalization and Aggregation in DBMS, which allow expressing database entities in a conceptual hierarchical manner.
tags:
- DBMS
- Generalization
- Aggregation
- Database Design
---

# DBMS - Generalization and Aggregation

The ER Model has the power of expressing database entities in a conceptual hierarchical manner. As the hierarchy goes up, it generalizes the view of entities, and as we go deep in the hierarchy, it gives us the detail of every entity included.

Going up in this structure is called generalization, where entities are clubbed together to represent a more generalized view. For example, a particular student named Mira can be generalized along with all the students. The entity shall be a student, and further, the student is a person. The reverse is called specialization where a person is a student, and that student is Mira.

## Generalization

As mentioned above, the process of generalizing entities, where the generalized entities contain the properties of all the generalized entities, is called generalization. In generalization, a number of entities are brought together into one generalized entity based on their similar characteristics. For example, pigeon, house sparrow, crow, and dove can all be generalized as Birds.

### Example of Generalization

| Specific Entities | Generalized Entity |
|-------------------|---------------------|
| Pigeon | Bird |
| House Sparrow | Bird |
| Crow | Bird |
| Dove | Bird |

```mermaid
---
title: Generalization Example
---
erDiagram
PIGEON }|..|{ BIRD : generalizes
HOUSE_SPARROW }|..|{ BIRD : generalizes
CROW }|..|{ BIRD : generalizes
DOVE }|..|{ BIRD : generalizes
```

## Specialization

Specialization is the opposite of generalization. In specialization, a group of entities is divided into sub-groups based on their characteristics. Take a group ‘Person’ for example. A person has a name, date of birth, gender, etc. These properties are common in all persons, human beings. But in a company, persons can be identified as employee, employer, customer, or vendor, based on what role they play in the company.

### Example of Specialization

| General Entity | Specialized Entities |
|----------------|--------------------------|
| Person | Employee, Employer, Customer, Vendor |

```mermaid
---
title: Specialization Example
---
erDiagram
PERSON ||--o{ EMPLOYEE : specializes
PERSON ||--o{ EMPLOYER : specializes
PERSON ||--o{ CUSTOMER : specializes
PERSON ||--o{ VENDOR : specializes
```

Similarly, in a school database, persons can be specialized as teacher, student, or a staff, based on what role they play in school as entities.

## Inheritance

We use all the above features of ER-Model in order to create classes of objects in object-oriented programming. The details of entities are generally hidden from the user; this process is known as abstraction.

Inheritance is an important feature of Generalization and Specialization. It allows lower-level entities to inherit the attributes of higher-level entities.

### Example of Inheritance

| Higher-level Entity | Attributes | Lower-level Entities |
|---------------------|-----------------------------|------------------------|
| Person | Name, Age, Gender | Student, Teacher |

```mermaid
---
title: Inheritance Example
---
erDiagram
PERSON {
string name
int age
string gender
}
STUDENT {
string school
string grade
}
TEACHER {
string subject
string department
}
PERSON ||--o{ STUDENT : inherits
PERSON ||--o{ TEACHER : inherits
```

For example, the attributes of a Person class such as name, age, and gender can be inherited by lower-level entities such as Student or Teacher.
181 changes: 181 additions & 0 deletions docs/DBMS/Entity-Relational Model/er-diagram-representation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
---
id: er-diagram-representation
title: DBMS ER Diagram Representation
sidebar_label: ER Diagram Representation
sidebar_position: 2
description: Learn how to represent the Entity-Relationship (ER) Model using ER diagrams, including entities, attributes, relationships, and cardinality.
tags:
- DBMS
- ER Diagram
- Database Design
---

# DBMS - ER Diagram Representation

Let us now learn how the ER Model is represented by means of an ER diagram. Any object, for example, entities, attributes of an entity, relationship sets, and attributes of relationship sets, can be represented with the help of an ER diagram.

## Entity

Entities are represented by means of rectangles. Rectangles are named with the entity set they represent.

```mermaid
---
title: Entity Representation
---
erDiagram
ENTITY {
string attribute1
int attribute2
}
```

## Attributes

### Simple Attributes

Attributes are the properties of entities. Attributes are represented by means of ellipses. Every ellipse represents one attribute and is directly connected to its entity (rectangle).

```mermaid
---
title: Simple Attributes
---
erDiagram
ENTITY {
string attribute1
}
```

### Composite Attributes

If the attributes are composite, they are further divided in a tree-like structure. Every node is then connected to its attribute. Composite attributes are represented by ellipses that are connected with an ellipse.

```mermaid
---
title: Composite Attributes
---
erDiagram
ENTITY {
string attribute1
}
attribute1 {
string sub_attribute1
string sub_attribute2
}
ENTITY ||--o{ attribute1 : has
```

### Multivalued Attributes

Multivalued attributes are depicted by double ellipses.

```mermaid
---
title: Multivalued Attributes
---
erDiagram
ENTITY {
string attribute1
int attribute2
string[] multivalued_attribute
}
ENTITY ||--o{ multivalued_attribute : has
```

### Derived Attributes

Derived attributes are depicted by dashed ellipses.

```mermaid
---
title: Derived Attributes
---
erDiagram
ENTITY {
string attribute1
int attribute2
int derived_attribute
}
ENTITY ||--o{ derived_attribute : derives
```

## Relationship

Relationships are represented by diamond-shaped boxes. The name of the relationship is written inside the diamond-box. All the entities (rectangles) participating in a relationship are connected to it by a line.

### Binary Relationship and Cardinality

A relationship where two entities are participating is called a binary relationship. Cardinality is the number of instances of an entity from a relation that can be associated with the relation.

#### One-to-One

When only one instance of an entity is associated with the relationship, it is marked as '1:1'. The following image reflects that only one instance of each entity should be associated with the relationship. It depicts one-to-one relationship.

```mermaid
---
title: One-to-One Relationship
---
erDiagram
ENTITY1 ||--|| ENTITY2 : relationship
```

#### One-to-Many

When more than one instance of an entity is associated with a relationship, it is marked as '1:N'. The following image reflects that only one instance of entity on the left and more than one instance of an entity on the right can be associated with the relationship. It depicts one-to-many relationship.

```mermaid
---
title: One-to-Many Relationship
---
erDiagram
ENTITY1 ||--o{ ENTITY2 : relationship
```

#### Many-to-One

When more than one instance of entity is associated with the relationship, it is marked as 'N:1'. The following image reflects that more than one instance of an entity on the left and only one instance of an entity on the right can be associated with the relationship. It depicts many-to-one relationship.

```mermaid
---
title: Many-to-One Relationship
---
erDiagram
ENTITY1 }o--|| ENTITY2 : relationship
```

#### Many-to-Many

The following image reflects that more than one instance of an entity on the left and more than one instance of an entity on the right can be associated with the relationship. It depicts many-to-many relationship.

```mermaid
---
title: Many-to-Many Relationship
---
erDiagram
ENTITY1 }o--o{ ENTITY2 : relationship
```

### Participation Constraints

#### Total Participation

Each entity is involved in the relationship. Total participation is represented by double lines.

```mermaid
---
title: Total Participation
---
erDiagram
ENTITY1 ||--|| ENTITY2 : relationship
```

#### Partial Participation

Not all entities are involved in the relationship. Partial participation is represented by single lines.

```mermaid
---
title: Partial Participation
---
erDiagram
ENTITY1 }o--|| ENTITY2 : relationship
```
Loading

0 comments on commit 96a275e

Please sign in to comment.