
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Insert multiple data using SET clause in MySQL?
Let us first create a table −
mysql> create table DemoTable1544 -> ( -> Id int , -> Name varchar(20) -> ); Query OK, 0 rows affected (2.47 sec)
Insert some records in the table using insert command. We have inserted multiple data using SET clause −
mysql> insert into DemoTable1544 set Id=101,Name='John Doe'; Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable1544 set Id=102,Name='Adam Smith'; Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable1544 set Id=103,Name='Chris Brown'; Query OK, 1 row affected (0.12 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1544;
This will produce the following output −
+------+-------------+ | Id | Name | +------+-------------+ | 101 | John Doe | | 102 | Adam Smith | | 103 | Chris Brown | +------+-------------+ 3 rows in set (0.00 sec)
- Related Articles
- How to update multiple rows using single WHERE clause in MySQL?
- Update with multiple values in MySQL WHERE clause
- What is the significance of using multiple columns in MySQL GROUP BY clause?
- Insert records from multiple tables in MySQL
- Concatenate data from multiple rows using GROUP_CONCAT() in MySQL?
- How to add a where clause in a MySQL Insert statement?
- Can we use MySQL GROUP BY clause with multiple columns like MySQL DISTINCT clause is used?
- Insert multiple rows in a single MySQL query
- MySQL query to insert multiple records quickly
- How to use MySQL DISTINCT clause on multiple columns?
- Can we fetch multiple values with MySQL WHERE Clause?
- How to multiple insert or batch insert at a time in MySQL query?
- How can we use WHERE clause with MySQL INSERT INTO command?
- Increment column value ‘ADD’ with MySQL SET clause
- Get the returned record set order in MySQL IN clause?

Advertisements