You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
18
18
---
19
19
20
-
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.
20
+
##
21
+
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.
21
22
22
23
23
24
:::note
24
25
Key Features of SQL:
25
26
Data Querying: Retrieve data from one or more tables using commands like **SELECT**.
26
27
27
-
Data Manipulation: Add, update, or delete records using **INSERT**, **UPDATE**, and **DELETE**.
28
+
DML (Data Manupulation Language): Add, update, or delete records using **INSERT**, **UPDATE**, and **DELETE**.
28
29
29
-
Data Definition: Define database structures using **CREATE**, **ALTER**, and **DROP**.
30
+
DDL (Data Definition Language): Define database structures using **CREATE**, **ALTER**, and **DROP**.
30
31
31
-
Data Control: Control access and permissions with **GRANT** and **REVOKE**.
32
+
DCL ( Data Control Language): Control access and permissions with **GRANT** and **REVOKE**.
33
+
34
+
TCL (Transactional Control Language): Involves **COMMIT** and **ROLLBACK**.
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.
45
+
46
+
Then company started developing database management system like SQL, Postgres,MySQL.
47
+
48
+
> Databases are two types, SQL(Relational, Analytical OLAP) and NOSQL(key value, Graph, Document). This NoSQL provides more flexibility over Relational as it dont have to follow schemas.
49
+
50
+
> Schema is named collection of tables, which can contains, views, index, datatypes, operators and functions.
32
51
:::
33
52
34
-
## What is SQL?
53
+
:::info
35
54
36
-
SQL became a standard of the American National Standards Institute (ANSI) in 1986 and of the International Organization for Standardization (ISO) in 1987. SQL can execute queries against a database and retrieve data from it. It allows users to insert, update, and delete records in a database. Additionally, SQL can be used to create new databases and new tables within them. It also supports the creation of stored procedures, views, and the ability to set permissions on tables, procedures, and views.
| 17 | Window Functions (`RANK`, `DENSE_RANK`, `ROW_NUMBER`) | Performs calculations across a set of table rows related to the current row. |
37
74
38
-
:::info
39
75
40
-
1.**International Organization for Standardization (ISO)**:
41
-
2.**American National Standards Institute (ANSI)**:
42
-
3. Basic SQL Commands:
76
+
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.
43
77
44
-
| Category | Command | Description |
45
-
| --- | --------------- | -------------------- |
46
-
| DQL (Query). | SELECT | Retrieve data from tables |
4.**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.
79
+
|**Category**|**Alias**|**Description**|
80
+
|---------------|-----------|-----------------|
81
+
| Tuple | Row | Record |
82
+
| Attribute | Col | Field |
53
83
54
-
| Category | Alias | Description |
55
-
| --- | --------------- | -------------------- |
56
-
| Tuple | Row | Record |
57
-
| Attribute | Col | Field|
58
84
59
85
60
86
**For example, the following SAQl code creates a table named students**
61
87
62
88
<Tabs>
63
-
<TabItemvalue="HTML">
89
+
<TabItem value="Basic SQL">
64
90
```sql
65
91
-- Create a table
66
92
CREATE TABLE Students (
@@ -96,20 +122,64 @@ SQL became a standard of the American National Standards Institute (ANSI) in 198
96
122
(No rows returned)
97
123
```
98
124
</TabItem>
125
+
<TabItem value="DDL">
126
+
```sql
127
+
-- CREATE TABLE statement to create a new table with columns and data types
128
+
CREATE TABLE customers (
129
+
id INT PRIMARY KEY,
130
+
name VARCHAR(50),
131
+
email VARCHAR(50));
132
+
133
+
-- ALTER TABLE statement to add a new column to an existing table
134
+
ALTER TABLE customers ADD COLUMN phone VARCHAR(20);
135
+
136
+
-- DROP TABLE statement to remove a table from the database
137
+
DROP TABLE customers;
138
+
```
139
+
</TabItem>
140
+
<TabItem value="DML">
141
+
```sql
142
+
-- INSERT statement to add new data to a table
143
+
INSERT INTO customers (name, email) VALUES ('John Doe', '[email protected]');
144
+
145
+
-- UPDATE statement to modify existing data in a table
146
+
UPDATE customers SET email = '[email protected]' WHERE name = 'John Doe';
147
+
148
+
-- DELETE statement to remove data from a table
149
+
DELETE FROM customers WHERE name = 'John Doe';
150
+
```
151
+
</TabItem>
152
+
<TabItem value="DCL">
153
+
```sql
154
+
-- CREATE USER statement to create a new user account with specific permissions
155
+
156
+
CREATE USER 'new_user' IDENTIFIED BY 'password';
157
+
GRANT SELECT, INSERT, UPDATE ON customers TO new_user;
158
+
```
159
+
</TabItem>
160
+
<TabItem value="TCL">
161
+
```sql
162
+
-- BEGIN TRANSACTION statement to start a new transaction
163
+
BEGIN TRANSACTION;
164
+
165
+
-- COMMIT statement to save changes made during a transaction
166
+
COMMIT;
167
+
168
+
-- ROLLBACK statement to undo changes made during a transaction
169
+
ROLLBACK;
170
+
```
171
+
</TabItem>
99
172
</Tabs>
100
173
101
174
102
-
5. **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—likeSELECT, INSERT, UPDATE, andDELETE—are the same across different database systems. ❌ But, SQL Implementations Are Not Fully Platform Independent:
175
+
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:
176
+
103
177
Different Database Management Systems (DBMS)—like MySQL, PostgreSQL, Oracle, SQL Server, and SQLite—extend SQL differently. They may:
104
178
105
179
- Use different data types (VARCHAR vs TEXT, etc.)
106
-
107
180
- Have custom functions and features
108
-
109
181
- Handle stored procedures, triggers, and syntax differently
110
-
111
182
- Offer different tools and performance optimizations
112
-
113
183
- So, SQL code written for one system may not work exactly the same on another without adjustments.
114
184
115
185
:::
@@ -120,6 +190,12 @@ Different Database Management Systems (DBMS)—like MySQL, PostgreSQL, Oracle, S
120
190
121
191
**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! 💬
122
192
193
+
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:
194
+
195
+
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.
196
+
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.
197
+
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.
198
+
123
199
---
124
200
125
201
## 📊 SQL: A Must-Have for Data-Driven Roles
@@ -141,15 +217,12 @@ From running ad-hoc queries to building pipelines and dashboards — SQL is ever
141
217
142
218
---
143
219
144
-
📌 *Master SQL to unlock the power of your data.*
145
-
146
-
147
-
### Steps to start using HTML
220
+
### Steps to start using SQL
148
221
149
222
**1. Set up your development environment**: Go to MySQL Downloads Page:
150
223
- Visit MySQL Workbench Downloads.
151
224
152
-
**2. Download the Installer:**: To create your first HTML document, follow these steps:
225
+
**2. Download the Installer:**: To create your first SQL commands, follow these steps:
153
226
154
227
- Select the version compatible with your operating system (Windows, macOS, or Linux).
155
228
- Click Download and follow the installation instructions.
0 commit comments