[#8] "MYSQL INSERT Statement Explained with Examples" | MySQL Tutorial | #ITTECH
"Learn how to use the INSERT statement in MySQL to add data into your tables. This step-by-step guide covers basic and advanced examples to help you master data insertion in MySQL. Perfect for beginners and developers looking to improve their SQL skills!"
=========================================================================
Here’s an example of using the `INSERT` statement in MySQL:
Basic Insert Statement
```sql
INSERT INTO users (username, email) VALUES ('john_doe', '[email protected]');
```
Explanation:
`INSERT INTO users`: Specifies the table name (`users`).
`(username, email)`: Lists the columns where the data will be inserted.
`VALUES ('john_doe', '[email protected]')`: Provides the values to be inserted into the specified columns.
Inserting Multiple Rows
```sql
INSERT INTO users (username, email)
VALUES
('jane_doe', '[email protected]'),
('alice_smith', '[email protected]'),
('bob_jones', '[email protected]');
```
Explanation:
The `VALUES` clause can include multiple rows by separating them with commas.