diff --git a/docs/sql/SQL-basics/ordering-data.md b/docs/sql/SQL-basics/ordering-data.md index f5cd7ba..718e2cf 100644 --- a/docs/sql/SQL-basics/ordering-data.md +++ b/docs/sql/SQL-basics/ordering-data.md @@ -30,10 +30,10 @@ For example, consider a table named `Friends`. Below is how a simple table might After using `ORDER BY`, we specify the column by which we want to order the entries. For example, to sort by the `name` column: -The first step in ordering table is the SELECT -ORDER BY helps you to arrange data in readable form -Here **FROM** specify the table we are selecting from ountries. -Here the query is ordering the number by name/. +The first step in ordering a table is the SELECT +ORDER BY helps you arrange data in a readable form +Here **FROM** specifies the table we are selecting from. +Here the query is ordering the records by the name/. :::info @@ -125,8 +125,8 @@ ORDER BY name; :::tip When requesting data with SQL staments like SELECT, we say that we are making a query. -From helps in select the name col from -While not necessary but its a good practice to finish the sql queries with; +From helps in select the name column from +While not necessary, it’s a good practice to finish SQL queries with a semicolon (;). By following these best practices, ASC is the default sort ordering method followed. diff --git a/docs/sql/intro-sql.md b/docs/sql/intro-sql.md index 6b61b48..86d99d7 100644 --- a/docs/sql/intro-sql.md +++ b/docs/sql/intro-sql.md @@ -1,12 +1,12 @@ --- id: intro-sql -title: Introduction of SQL #Remember to keep this unique, as it maps with giscus discussions in the recodehive/support/general discussions -sidebar_label: Introduction of SQL #displays in sidebar +title: Introduction to SQL # Unique identifier, used for discussions mapping +sidebar_label: Introduction to SQL # Appears in sidebar sidebar_position: 1 tags: [ sql, - introduction of sql, + introduction to sql, what is sql, why learn sql, how to use sql, @@ -14,226 +14,224 @@ tags: sql elements, sql attributes, ] -description: In this tutorial, you will learn about SQL, its importance, what is SQL, why learn SQL, how to use SQL, steps to start using SQL, and more. +description: In this tutorial, you will learn about SQL, its importance, what SQL is, why to learn SQL, how to use SQL, steps to get started, and more. --- -## -SQL **Structured Query Language** is a standard programming language used to manage and manipulate relational databases. It allows users to store, retrieve, update, and delete data in a structured format. SQL became a standard of the American National Standards Institute (ANSI) in 1986 and of the International Organization for Standardization (ISO) in 1987. +## Introduction +**SQL** (Structured Query Language) is the standard programming language used to manage and manipulate relational databases. It enables users to store, retrieve, update, and delete data in a structured format. SQL became an ANSI standard in 1986 and an ISO standard in 1987. :::note -Key Features of SQL: -Data Querying: Retrieve data from one or more tables using commands like **SELECT**. +**Key Features of SQL:** -DML (Data Manupulation Language): Add, update, or delete records using **INSERT**, **UPDATE**, and **DELETE**. - -DDL (Data Definition Language): Define database structures using **CREATE**, **ALTER**, and **DROP**. - -DCL ( Data Control Language): Control access and permissions with **GRANT** and **REVOKE**. - -TCL (Transactional Control Language): Involves **COMMIT** and **ROLLBACK**. +- **Data Querying:** Retrieve data from tables using commands like `SELECT`. +- **DML (Data Manipulation Language):** Add, update, or delete records using `INSERT`, `UPDATE`, and `DELETE`. +- **DDL (Data Definition Language):** Define database structures using `CREATE`, `ALTER`, and `DROP`. +- **DCL (Data Control Language):** Control access and permissions with `GRANT` and `REVOKE`. +- **TCL (Transaction Control Language):** Manage transactions with `COMMIT` and `ROLLBACK`. ::: - - [![GitHub](./assets/01-sql-intro.png)](https://github.com/sanjay-kv) - + + [![GitHub](./assets/01-sql-intro.png)](https://github.com/sanjay-kv) + +:::success +Let’s talk about the history of data storage: +Data storage began with physical files and shelves. Later, companies started using tools like Excel and Access. However, these tools have limitations when handling large data volumes. -:::success -Let's talk about history of Storing Data, It's started with physical files and shelf. Then later on company started using Excel or Access. There is limitation for these tools when comes to high data volume. +To overcome these challenges, companies developed database management systems (DBMS) such as SQL databases (like PostgreSQL and MySQL). -Then company started developing database management system like SQL, Postgres,MySQL. +> There are two main types of databases: +> +> - **SQL/Relational databases** (supports Online Transaction Processing [OLTP] and Online Analytical Processing [OLAP]). +> - **NoSQL databases** (key-value, graph, document)—often used for semi-structured or unstructured datasets. NoSQL databases provide more flexibility than relational databases because they don’t require fixed schemas. -> Databases are two types, SQL(Relational, Analytical OLAP) and NOSQL(key value, Graph, Document) mainly used for un-structured dataset. This NoSQL provides more flexibility over Relational as it dont have to follow schemas. +> **Schema:** A schema is a named collection of tables and can also include views, indexes, datatypes, operators, and functions. +::: -> Schema is named collection of tables, which can contains, views, index, datatypes, operators and functions. +:::info + +| **#** | **Keyword/Concept** | **Description** | +|-------|--------------------------------------------------|------------------------------------------------------------------------| +| 1 | `SELECT` | Retrieves data from one or more tables in a database. | +| 2 | `FROM` | Specifies the table(s) to retrieve data from. | +| 3 | `WHERE` | Filters rows based on specified conditions. | +| 4 | `JOIN` | Combines rows from two or more tables based on a related column. | +| 5 | `GROUP BY` | Groups rows that have the same values into summary rows. | +| 6 | `ORDER BY` | Sorts the result set by one or more columns. | +| 7 | `HAVING` | Filters data after grouping using `GROUP BY`. | +| 8 | `INSERT` | Adds new records to a table. | +| 9 | `UPDATE` | Modifies existing records in a table. | +| 10 | `DELETE` | Removes records from a table. | +| 11 | `CREATE` | Creates a new database object (table, view, etc.). | +| 12 | `ALTER` | Modifies an existing database object. | +| 13 | `DROP` | Deletes a database object. | +| 14 | Aggregation Functions (`MIN`, `MAX`, `AVG`, `COUNT`) | Performs calculations on a set of values and returns a single value. | +| 15 | Joins (`INNER`, `LEFT`, `FULL`) | Retrieves data from multiple tables with matching or non-matching values.| +| 16 | `CASE` Statement | Adds conditional logic within SQL queries. | +| 17 | Window Functions (`RANK`, `DENSE_RANK`, `ROW_NUMBER`) | Performs calculations across sets of rows related to the current row. | + +#### Structure and Content + +In SQL, the *structure* refers to how data is organized in tables; the *content* refers to the actual data stored within those tables. + +| **Category** | **Alias** | **Description** | +|---------------|-----------|-----------------| +| Tuple | Row | Record | +| Attribute | Column | Field | ::: -:::info +**Example: The following SQL code creates a table named `Students`.** + + + +-- Create a table +CREATE TABLE Students ( +ID INT, +Name VARCHAR(50), +Age INT +); + +-- Insert a record (recommended: specify column names) +INSERT INTO Students (ID, Name, Age) VALUES (1, 'Alice', 22); + +-- Query the table +SELECT * FROM Students; + +-- Update a record +UPDATE Students SET Age = 23 WHERE ID = 1; + +-- Delete a record +DELETE FROM Students WHERE ID = 1; + +text + + +-- After creating the table and inserting a record: +ID Name Age +1 Alice 22 + +-- After updating the record: +ID Name Age +1 Alice 23 + +-- After deleting the record: +(No rows returned) + +text + + +-- CREATE TABLE statement to create a new table with columns and data types +CREATE TABLE customers ( +id INT PRIMARY KEY, +name VARCHAR(50), +email VARCHAR(50) +); + +-- ALTER TABLE statement to add a new column to an existing table +ALTER TABLE customers ADD COLUMN phone VARCHAR(20); + +-- DROP TABLE statement to remove a table from the database +DROP TABLE customers; + +text + + +-- INSERT statement to add new data to a table +INSERT INTO customers (name, email) VALUES ('John Doe', 'johndoe@email.com'); + +-- UPDATE statement to modify existing data in a table +UPDATE customers SET email = 'new@email.com' WHERE name = 'John Doe'; + +-- DELETE statement to remove data from a table +DELETE FROM customers WHERE name = 'John Doe'; + +text + + +-- CREATE USER and GRANT statements (syntax may vary by DBMS) +CREATE USER 'new_user' IDENTIFIED BY 'password'; +GRANT SELECT, INSERT, UPDATE ON customers TO new_user; + +text + + +-- BEGIN TRANSACTION statement to start a new transaction +BEGIN TRANSACTION; + +-- COMMIT statement to save changes made during a transaction +COMMIT; + +-- ROLLBACK statement to undo changes made during a transaction +ROLLBACK; + +text + + -| **#** | **Keyword/Concept** | **Description** | -|-------|--------------------------------------------------|---------------------------------------------------------------------------------| -| 1 | `SELECT` | Retrieves data from one or more tables in a database. | -| 2 | `FROM` | Specifies the table or tables to retrieve data from. | -| 3 | `WHERE` | Filters rows based on specific conditions. | -| 4 | `JOIN` | Combines rows from two or more tables based on a related column. | -| 5 | `GROUP BY` | Groups rows that have the same values into summary rows. | -| 6 | `ORDER BY` | Sorts the result-set by one or more columns. | -| 7 | `HAVING` | Filters data after grouping using `GROUP BY`. | -| 8 | `INSERT` | Adds new records to a table. | -| 9 | `UPDATE` | Modifies existing records in a table. | -| 10 | `DELETE` | Removes records from a table. | -| 11 | `CREATE` | Creates a new database object (table, view, etc.). | -| 12 | `ALTER` | Modifies an existing database object. | -| 13 | `DROP` | Deletes a database object. | -| 14 | Aggregation Functions (`MIN`, `MAX`, `AVG`, `COUNT`) | Performs calculations on a set of values and returns a single value. | -| 15 | Joins (`INNER`, `LEFT`, `FULL`) | Retrieves data from multiple tables with matching or non-matching values. | -| 16 | `CASE` Statement | Adds conditional logic within SQL queries. | -| 17 | Window Functions (`RANK`, `DENSE_RANK`, `ROW_NUMBER`) | Performs calculations across a set of table rows related to the current row. | +--- +### Advantages: Platform Independence — Yes and No -1. **Structure and Content**: In SQL, the structure refers to how data is organized in tables, and the content refers to the actual data stored within those tables. +The core SQL language (based on ANSI/ISO standards) is platform independent, meaning the basic syntax and concepts—such as `SELECT`, `INSERT`, `UPDATE`, and `DELETE`—are the same across different database systems. +However, most Database Management Systems (DBMS)—like MySQL, PostgreSQL, Oracle, SQL Server, and SQLite—extend SQL differently: -| **Category** | **Alias** | **Description** | -|---------------|-----------|-----------------| -| Tuple | Row | Record | -| Attribute | Col | Field | - - - - **For example, the following SAQl code creates a table named students** - - - - ```sql - -- Create a table - CREATE TABLE Students ( - ID INT, - Name VARCHAR(50), - Age INT - ); - - -- Insert a record - INSERT INTO Students VALUES (1, 'Alice', 22); - - -- Query the table - SELECT * FROM Students; - - -- Update a record - UPDATE Students SET Age = 23 WHERE ID = 1; - - -- Delete a record - DELETE FROM Students WHERE ID = 1; - ``` - - - ```plaintext - -- After creating the table and inserting a record: - ID Name Age - 1 Alice 22 - - -- After updating the record: - ID Name Age - 1 Alice 23 - - -- After deleting the record: - (No rows returned) - ``` - - - ```sql - -- CREATE TABLE statement to create a new table with columns and data types - CREATE TABLE customers ( - id INT PRIMARY KEY, - name VARCHAR(50), - email VARCHAR(50)); - - -- ALTER TABLE statement to add a new column to an existing table - ALTER TABLE customers ADD COLUMN phone VARCHAR(20); - - -- DROP TABLE statement to remove a table from the database - DROP TABLE customers; - ``` - - - ```sql - -- INSERT statement to add new data to a table - INSERT INTO customers (name, email) VALUES ('John Doe', 'johndoe@email.com'); - - -- UPDATE statement to modify existing data in a table - UPDATE customers SET email = 'new@email.com' WHERE name = 'John Doe'; - - -- DELETE statement to remove data from a table - DELETE FROM customers WHERE name = 'John Doe'; - ``` - - - ```sql - -- CREATE USER statement to create a new user account with specific permissions - - CREATE USER 'new_user' IDENTIFIED BY 'password'; - GRANT SELECT, INSERT, UPDATE ON customers TO new_user; - ``` - - - ```sql - -- BEGIN TRANSACTION statement to start a new transaction - BEGIN TRANSACTION; - - -- COMMIT statement to save changes made during a transaction - COMMIT; - - -- ROLLBACK statement to undo changes made during a transaction - ROLLBACK; - ``` - - - - - -1. Advantages: **Platform Independent?**: Yes and No — It Depends. The core SQL language (based on ANSI/ISO standards) is platform-independent, meaning the basic syntax and concepts—like SELECT, INSERT, UPDATE, and DELETE—are the same across different database systems. ❌ But, SQL Implementations Are Not Fully Platform Independent: - -Different Database Management Systems (DBMS)—like MySQL, PostgreSQL, Oracle, SQL Server, and SQLite—extend SQL differently. They may: - -- Use different data types (VARCHAR vs TEXT, etc.) -- Have custom functions and features +- Use different data types (e.g., `VARCHAR`, `TEXT`) +- Offer custom functions and features - Handle stored procedures, triggers, and syntax differently -- Offer different tools and performance optimizations -- So, SQL code written for one system may not work exactly the same on another without adjustments. - -::: +- Provide varied tools and optimization strategies +As a result, SQL code written for one system might not work exactly the same on another without some adjustments. +--- # 🗃️ Why Learn SQL? -**SQL (Structured Query Language)** is the standard language used to manage and query **relational databases** — the most common way data is stored across businesses. Whether it's **MySQL**, **PostgreSQL**, **SQL Server**, or **SQLite** — they all speak SQL! 💬 +SQL (Structured Query Language) is the standard language for managing and querying relational databases—the most common method businesses use to store data. Whether it's **MySQL**, **PostgreSQL**, **SQL Server**, or **SQLite**—all use SQL! -Data engineering is the process of collecting, transforming, and storing data in a way that allows for easy analysis and access. SQL is a critical tool in this process because it allows data engineers to: +Data engineering involves collecting, transforming, and storing data so it is accessible for analysis. SQL is a crucial tool in this process because it allows you to: + +1. **Retrieve data:** Query the database for specific information based on criteria. +2. **Manipulate data:** Add, delete, or update data to keep it accurate and up to date. +3. **Manage data:** Create tables, define relationships, and set up permissions to keep data organized and secure. -1. ✅Retrieve data: SQL enables data engineers to retrieve specific data from a database by querying it based on certain criteria. This helps to ensure that data is accessible and easy to find. -2. ✅Manipulate data: SQL also enables data engineers to manipulate data within a database by adding, deleting, or updating data. This helps to ensure that data is accurate and up-to-date. -3. ✅Manage data: SQL enables data engineers to manage databases by creating tables, defining relationships between tables, and setting up security permissions. This helps to ensure that data is organized and secure. - --- ## 📊 SQL: A Must-Have for Data-Driven Roles SQL is a **critical skill** for anyone working with data. It empowers you to extract, analyze, and transform information efficiently. -Here are some roles where SQL is a game-changer: +Some roles where SQL is essential: -👨‍💻 **Data Analysts** -🛠️ **Data Engineers** -🔬 **Data Scientists** -📈 **Business Intelligence Professionals** -💻 **Software Developers** -📣 **Marketers** -📦 **Product Managers** -📊 **Business Analysts** +- **Data Analysts** +- **Data Engineers** +- **Data Scientists** +- **Business Intelligence Professionals** +- **Software Developers** +- **Marketers** +- **Product Managers** +- **Business Analysts** -From running ad-hoc queries to building pipelines and dashboards — SQL is everywhere in data work! 🚀 +From running ad-hoc queries to building data pipelines and dashboards, SQL is everywhere in data work! --- -### Steps to start using SQL - -**1. Set up your development environment**: Go to MySQL Downloads Page: - - Visit MySQL Workbench Downloads. - -**2. Download the Installer:**: To create your first SQL commands, follow these steps: - - - Select the version compatible with your operating system (Windows, macOS, or Linux). - - Click Download and follow the installation instructions. - - https://dev.mysql.com/downloads/workbench/ +### Steps to Start Using SQL +**1. Set up your development environment:** +Go to the MySQL Workbench Downloads page. +**2. Download the installer:** +- Select the version compatible with your operating system (Windows, macOS, or Linux). +- Click **Download** and follow the installation instructions. +- Visit: https://dev.mysql.com/downloads/workbench +--- ## Conclusion -Learning SQL empowers you to talk to data, unlock insights, and build data-driven solutions—making it one of the most valuable and versatile skills in the digital world. +Learning SQL empowers you to interact with data, unlock insights, and build data-driven solutions—making it one of the most valuable and versatile skills in the digital world. \ No newline at end of file diff --git a/docs/sql/setup-environment.md b/docs/sql/setup-environment.md index 6f46c75..53fb755 100644 --- a/docs/sql/setup-environment.md +++ b/docs/sql/setup-environment.md @@ -1,12 +1,12 @@ --- id: setup-environment -title: Setting up your development environment -sidebar_label: Setting up environment +title: Setting up Your Development Environment +sidebar_label: Setting up Environment sidebar_position: 3 tags: [ sql, - introduction of sql, + introduction to sql, what is sql, why learn sql, setup sql, @@ -14,51 +14,73 @@ tags: sql server, sql setup, ] -description: In this tutorial, you will learn how to set up your development environment for HTML development. +description: In this tutorial, you will learn how to set up your development environment for SQL development. --- -There are different emulators available for SQL Queries, but as a beginner its always good to start with Installing MYSQL Server and Workbench in your system, it helps you to understand the overall process and industry settings. This MYSQL Workbench is called the IDE (Itegrated developement enviornment). -We will guide you to setup the IDE in your system, and navigate further executing SQL queries and creating database in the IDE. +## Introduction -### **1. Download the Installer:**: To install download the installer. +To start learning SQL, it's essential to have a development environment where you can experiment and practice running queries. While there are many online emulators and sandboxes available, beginners will benefit most by installing MySQL Server and MySQL Workbench on their own system. This approach helps you understand how professional environments function and prepares you for real-world scenarios. -Click the link below to download MySQL Workbench: +**MySQL Workbench** is an IDE (Integrated Development Environment) for working with MySQL servers and databases. We'll guide you through setting up this IDE on your system and teach you how to use it to create databases and run SQL queries. + +--- + +### 1. Download and Install MySQL Server and Workbench + +Click the link below to access the **official MySQL Workbench download page**: 👉 [MySQL Workbench Official Download Page](https://dev.mysql.com/downloads/workbench/) -- ✅ Choose your OS (Windows, macOS, or Linux) -- ✅ Follow the installation instructions +- ✅ Choose your operating system (Windows, macOS, or Linux). +- ✅ Download the appropriate installer. +- ✅ Follow the step-by-step installation instructions provided on the site. + +You can also watch this video tutorial for additional guidance: --- -### 🍎 macOS Users -- 💾 [Server Installer](http://bit.ly/2PU2IZU) -- 💻 [Workbench Installer](http://bit.ly/2B2xiZ2) +### 🍎 For macOS Users + +- 💾 [Download MySQL Server for macOS](http://bit.ly/2PU2IZU) +- 💻 [Download MySQL Workbench for macOS](http://bit.ly/2B2xiZ2) --- -### 🐧 Linux Users -- 💾 [Server Installer](http://bit.ly/2DijNpJ) -- 💻 [Workbench Installer](http://bit.ly/2B153d8) +### 🐧 For Linux Users ---- +- 💾 [Download MySQL Server for Linux](http://bit.ly/2DijNpJ) +- 💻 [Download MySQL Workbench for Linux](http://bit.ly/2B153d8) +--- ## Why Do You Need an IDE? -This IDE helps you to execute and maintain the workflow of SQL, It acts as a source code editor, and a debugger. It basically help you to execute and debug any bugs for developer. Especially when comes to DBA (Database adminstration), managing huge dataset can be tiring here, it will help you with performance dashboard and quick improvement features. +An IDE offers more than just a place to type SQL code. It provides tools for: + +- Managing and visualizing databases and tables +- Writing, executing, and debugging SQL queries +- Viewing database schema and structure +- Monitoring performance (especially useful for administrators) +- Making database management easier and more efficient + +**Think of the IDE as a “window to your database”**: you can see and interact with your data without affecting the actual database by just closing the tool. Removing the IDE does not delete your database—just like closing a window doesn't affect the house behind it. +--- + +### Key Features to Look For in an IDE -### Key Features to Look for in an IDE/Text Editor +1. **Syntax Highlighting:** Makes code more readable by coloring keywords and other elements. +2. **Database Visualization:** Helps you structure and organize database objects efficiently. +3. **Integrated Management Tools:** Lets you store data, manage workflows, organize tables, and perform administrative operations (like backup and user management). +4. **Query Execution & Debugging:** Allows you to test and debug your SQL commands directly. +5. **Performance Monitoring:** Some IDEs offer dashboards to monitor query performance and database health. -1. **Syntax :** Highlights the color, make code readbility. -2. **Accelerate Work stucture:** Help you to sort and visualise the messy database. -3. **Helps managing Database:** Allows you to store the data, create workflow and organise it. +--- ## Conclusion -I hope you understood the concept here, if not yet, think like its a nice view from your house, it lets you see whats happening outside in your comfort zone, if anything happening to the house, the view remain same, Workbench works the simillar way, it helps you to see the data in the databse, just like your house SQL workbench doesnt have the data, if you remove workbench nothing happens to your databse. +I hope you understood the concept here, if not yet, think like its a nice view from your house, it lets you see whats happening outside in your comfort zone, if anything happening to the house, the view remain same, Workbench works in the similar way, it helps you to see the data in the databse, just like your house. SQL workbench doesnt have the data, if you remove workbench nothing happens to your databse. - \ No newline at end of file + diff --git a/package.json b/package.json index 1dac038..cee8e8d 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "typecheck": "tsc" }, "dependencies": { + "@docusaurus/core": "^3.8.1", "@docusaurus/plugin-content-docs": "3.8.1", "@docusaurus/plugin-google-analytics": "^3.8.1", @@ -23,6 +24,7 @@ "@docusaurus/theme-classic": "^3.8.1", "@docusaurus/theme-mermaid": "3.8.1", "@docusaurus/theme-search-algolia": "3.8.1", + "@floating-ui/react": "^0.27.8", "@giscus/react": "^3.1.0", "@mdx-js/react": "^3.0.0", diff --git a/src/theme/Footer/index.tsx b/src/theme/Footer/index.tsx index a14a2b7..73bf55c 100644 --- a/src/theme/Footer/index.tsx +++ b/src/theme/Footer/index.tsx @@ -1,26 +1,329 @@ -import React from 'react'; -import {useThemeConfig} from '@docusaurus/theme-common'; -import FooterLayout from '@theme/Footer/Layout'; -import FooterCopyright from '@theme/Footer/Copyright'; -import FooterLogo from '@theme/Footer/Logo'; -import FooterLinks from '@theme/Footer/Links'; -import type {Props} from '@theme/Footer'; - -function Footer(): JSX.Element | null { - const {footer} = useThemeConfig(); - if (!footer) { - return null; - } - const {copyright, links, logo, style} = footer; + +import React from "react"; +// import a from "@docusaurus/a"; +import { useColorMode } from "@docusaurus/theme-common"; + + + +const Footer = () => { + const { colorMode } = useColorMode(); return ( - } - logo={logo && } - copyright={copyright && } - /> + ); } -export default React.memo(Footer); + +export default Footer; +