Skip to content

Commit 92ac96d

Browse files
authored
Merge branch 'main' into 230
2 parents eec22c3 + 21165ed commit 92ac96d

File tree

58 files changed

+7275
-109
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+7275
-109
lines changed

.github/workflows/greetings.yml

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,61 @@
1-
name: Greetings
1+
name: 'Greetings'
22

3-
on: [pull_request_target, issues]
3+
on:
4+
issues:
5+
types: [opened]
6+
pull_request_target:
7+
types: [opened]
8+
9+
permissions:
10+
issues: write
11+
pull-requests: write
412

513
jobs:
6-
greeting:
14+
welcome:
715
runs-on: ubuntu-latest
8-
permissions:
9-
issues: write
10-
pull-requests: write
16+
1117
steps:
18+
- name: Check out repository
19+
uses: actions/checkout@v4
20+
1221
- name: Greet first-time contributors
1322
id: greet
1423
uses: actions/first-interaction@v1
1524
with:
1625
repo-token: ${{ secrets.GITHUB_TOKEN }}
1726
issue-message: |
18-
Hi there! 👋 Thank you for opening your first issue on CodeHarborHub. We're excited to hear your thoughts and help you out. Please provide as much detail as you can so we can assist you effectively.
27+
Hi there! 👋 Thank you for opening your issue on CodeHarborHub. We're excited to hear your thoughts and help you out. You've raised a great topic! Please provide as much detail as you can so we can assist you effectively. Welcome aboard!
1928
pr-message: |
20-
Hi there! 👋 Thank you for submitting your first pull request to CodeHarborHub. We appreciate your contribution! Our team will review it soon. If you have any questions or need further assistance, feel free to reach out.
29+
Hi there! 👋 Thank you for submitting your pull request to CodeHarborHub. Great job on the contribution! 🎉 We appreciate your efforts and our team will review it soon. If you have any questions or need further assistance, feel free to reach out. Keep up the great work!
30+
31+
- name: Assign issue or pull request to team member
32+
if: github.event_name == 'issues' || github.event_name == 'pull_request_target'
33+
run: |
34+
ISSUE_NUMBER=${{ github.event.issue.number || github.event.pull_request.number }}
35+
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
36+
-d '{"assignees":["team-member"]}' \
37+
"https://api.github.com/repos/${{ github.repository }}/issues/${ISSUE_NUMBER}"
38+
39+
- name: Welcome message for community contributors
40+
if: github.event_name == 'issues' || github.event_name == 'pull_request_target'
41+
uses: EddieHubCommunity/gh-action-community/src/welcome@main
42+
with:
43+
github-token: ${{ secrets.GITHUB_TOKEN }}
44+
issue-message: "Hi @${{ github.actor }}! Thanks for opening this issue. We appreciate your contribution to this open-source project. Your input is valuable and we aim to respond or assign your issue as soon as possible. Thanks again!"
45+
pr-message: "Great job, @${{ github.actor }}! 🎉 Thank you for submitting your pull request to CodeHarborHub. We appreciate your contribution and enthusiasm! Our team will review it soon. If you have any questions or need further assistance, feel free to reach out. Thanks for contributing!"
46+
47+
- name: Label first-time issues
48+
if: github.event_name == 'issues'
49+
run: |
50+
ISSUE_NUMBER=${{ github.event.issue.number }}
51+
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
52+
-d '{"labels":["CodeHarborHub - Thanks for creating an issue!"]}' \
53+
"https://api.github.com/repos/${{ github.repository }}/issues/${ISSUE_NUMBER}"
54+
55+
- name: Label first-time pull requests
56+
if: github.event_name == 'pull_request_target'
57+
run: |
58+
PR_NUMBER=${{ github.event.pull_request.number }}
59+
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
60+
-d '{"labels":["CodeHarborHub - Thanks for creating a pull request!"]}' \
61+
"https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "SQL",
3+
"position": 8,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Explore SQL in DBMS."
7+
}
8+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
id: sql-aggregate-function
3+
title: DBMS - SQL Aggregate Functions
4+
sidebar_label: Aggregate Functions
5+
sidebar_position: 3
6+
description: Learn about the SQL Aggregate Functions.
7+
tags:
8+
- DBMS
9+
- SQL
10+
- SQL-Functions
11+
- Database Design
12+
---
13+
14+
# DBMS - SQL Aggregate Functions
15+
16+
Aggregate functions in SQL are used to perform calculations on multiple rows of a table's column and return a single value. These functions are essential for data analysis and reporting as they help in summarizing large datasets.
17+
18+
## COMMON AGGREGATE FUNCTIONS
19+
20+
1. **COUNT():** The COUNT() function returns the number of rows that match a specified condition. This query returns the total number of rows in the table.
21+
```sql
22+
SELECT COUNT(*) AS total_rows
23+
FROM table_name;
24+
```
25+
26+
2. **SUM():** The SUM() function returns the total sum of a numeric column. This query calculates the sum of all values in column_name.
27+
```sql
28+
SELECT SUM(column_name) AS total_sum
29+
FROM table_name;
30+
```
31+
32+
3. **AVG():** The AVG() function returns the average value of a numeric column. This query calculates the average value of column_name.
33+
```sql
34+
SELECT AVG(column_name) AS average_value
35+
FROM table_name;
36+
```
37+
38+
4. **MIN():** The MIN() function returns the smallest value in a specified column. This query finds the smallest value in column_name.
39+
```sql
40+
SELECT MIN(column_name) AS minimum_value
41+
FROM table_name;
42+
```
43+
44+
5. **MAX():** The MAX() function returns the largest value in a specified column. This query finds the largest value in column_name.
45+
```sql
46+
SELECT MAX(column_name) AS maximum_value
47+
FROM table_name;
48+
```
49+
50+
## AGGREGATE FUNCTIONS WITH GROUP BY
51+
52+
Aggregate functions are often used in conjunction with the GROUP BY clause to group the result set by one or more columns and perform the calculation on each group.
53+
```sql
54+
SELECT department, COUNT(*) AS total_employees
55+
FROM employees
56+
GROUP BY department;
57+
```
58+
This query groups the employees by their department and returns the number of employees in each department.
59+
60+
```sql
61+
SELECT department, COUNT(*) AS total_employees, AVG(salary) AS average_salary, MAX(salary) AS highest_salary
62+
FROM employees
63+
GROUP BY department;
64+
```
65+
This query groups the employees by their department and returns the total number of employees, average salary, and highest salary in each department.
66+
67+
## AGGREGATE FUNCTIONS USING HAVING
68+
69+
The HAVING clause is used to filter groups based on the result of aggregate functions. It is similar to the WHERE clause, but WHERE cannot be used with aggregate functions.
70+
```sql
71+
SELECT department, COUNT(*) AS total_employees
72+
GROUP BY department
73+
HAVING COUNT(*) > 10;
74+
```
75+
This query groups the employees by their department and returns the departments that have more than 10 employees.
76+
77+
You can combine multiple aggregate functions in a single query to perform various calculations.
78+
```sql
79+
SELECT COUNT(*) AS total_rows, SUM(column_name) AS total_sum, AVG(column_name) AS average_value
80+
FROM table_name;
81+
```
82+
This query returns the total number of rows, the sum of column_name, and the average value of column_name.
83+
84+
Aggregate functions are powerful tools in SQL for summarizing and analyzing data. By mastering these functions, you can perform complex data analysis and gain valuable insights from your database.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
id: sql-basic-concepts
3+
title: DBMS - SQL Basic Concepts
4+
sidebar_label: Basic Concepts
5+
sidebar_position: 1
6+
description: Learn about the Structured Query language (SQL), its basic concepts, data types, operators, and commands that form the foundation of database manipulation.
7+
tags:
8+
- DBMS
9+
- SQL
10+
- Database Design
11+
---
12+
13+
# DBMS - SQL Basic Concepts
14+
15+
SQL stands for Structured Query Language. It is used to access and manipulate data in databases. By executing queries SQL can *create*, *update*, *delete*, and *retrieve* data in databases like MySQL, Oracle, PostgreSQL, etc. Overall, SQL is a query language that communicates with databases.
16+
17+
## Why SQL?
18+
SQL helps to easily get information from data with high efficiency. Best Part? Without a lot of coding knowledge, we can manage a database with SQL. Anyone who knows English can master SQL queries in no time.
19+
When we are executing the command of SQL on any Relational database managemnet system, then the system automatically finds the best routine to carry out our requests, and the SQL engine determines how to interpret the particular command.
20+
21+
22+
## SQL DATABASE
23+
The very first step is to store the information in database, hence, we will first create a database.
24+
25+
1. **CREATE:**
26+
To create a new database in SQL we use this command. Note that blank spaces are not allowed in the name and is case-insenitive.
27+
```sql
28+
CREATE DATABASE database_name;
29+
2. **SHOW:**
30+
To view all the databases, we can use the keyword show. It returns a list of all the databases that exist in our system.
31+
```sql
32+
SHOW DATABASE;
33+
3. **USE:**
34+
To change the database or select another database, we use the command:
35+
```sql
36+
USE database_name;
37+
4. **DROP:**
38+
It is used to remove the entire database from the system. Once deleted, it can not be retrieved.
39+
We can use the if exists clause to avoid any errors.
40+
```sql
41+
DROP DATABASE database_name;
42+
DROP DATABASE IF EXISTS database_name;
43+
5. **RENAME:**
44+
It is used to rename the database.
45+
```sql
46+
RENAME DATABASE former_database_name TO new_database_name;
47+
48+
## SQL TABLES
49+
Now we have created the database. We will create tables inside our database. They are very similar to spreadsheets, which store data in very organized grid format. We can create as many tables as we require.
50+
1. **CREATE:**
51+
To create a new table in database we use this command. We define the structure of table and the datatypes of columns.
52+
```sql
53+
CREATE table Employee(
54+
EmployeeID INT PRIMARY KEY,
55+
FirstName VARCHAR(50),
56+
LastName VARCHAR(50),
57+
Department VARCHAR(50),
58+
Salary DECIMAL(10, 2)
59+
);
60+
2. **DELETE:**
61+
It is used to delete data in a database. We selectively remove records from a database table based on certain conditions.
62+
```sql
63+
DELETE FROM table_name WHERE some_condition;
64+
3. **DROP:**
65+
It is used to delete data and structure of the table from the database permanently.
66+
```sql
67+
DROP TABLE table_name;
68+
4. **ALTER:**
69+
It is used to rename the table.
70+
```sql
71+
ALTER TABLE former_table_name RENAME TO new_table_name;

0 commit comments

Comments
 (0)