Skip to content

Commit fa55e44

Browse files
authored
Added DML Statements
1 parent 4cba226 commit fa55e44

File tree

1 file changed

+46
-3
lines changed

1 file changed

+46
-3
lines changed

README.md

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ DROP DATABASE mydatabase;
6767

6868
#### TRUNCATE 🚮
6969

70+
Used to delete all rows from a table without deleting the table itself.
71+
72+
```sql
73+
-- Truncate a table
74+
TRUNCATE TABLE employees;
75+
```
76+
77+
7078
### Data Query Language (DQL) 🔍
7179

7280
DQL is used to query the database and retrieve data.
@@ -83,9 +91,44 @@ SELECT name, department FROM employees WHERE age > 30;
8391
SELECT * FROM employees;
8492
```
8593

86-
Used to delete all rows from a table without deleting the table itself.
94+
### Data Manipulation Language (DML) ➕
95+
96+
DML statements are used for managing data within schema objects.
97+
98+
#### INSERT ➕
99+
100+
Used to insert new records into a table.
87101

88102
```sql
89-
-- Truncate a table
90-
TRUNCATE TABLE employees;
103+
-- Insert a single row
104+
INSERT INTO employees (id, name, age, department) VALUES (1, 'John Doe', 30, 'HR');
105+
106+
-- Insert multiple rows
107+
INSERT INTO employees (id, name, age, department) VALUES
108+
(2, 'Jane Smith', 25, 'Finance'),
109+
(3, 'Mike Brown', 35, 'IT');
110+
```
111+
112+
#### UPDATE ✏️
113+
114+
Used to update existing records within a table.
115+
116+
```sql
117+
-- Update a single column
118+
UPDATE employees SET age = 31 WHERE id = 1;
119+
120+
-- Update multiple columns
121+
UPDATE employees SET age = 32, department = 'Management' WHERE id = 1;
122+
```
123+
124+
#### DELETE ➖
125+
126+
Used to delete records from a table.
127+
128+
```sql
129+
-- Delete specific records
130+
DELETE FROM employees WHERE age < 30;
131+
132+
-- Delete all records
133+
DELETE FROM employees;
91134
```

0 commit comments

Comments
 (0)