
- 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
How do I insert multiple values in a column with a single MySQL query?
To insert multiple values in a column, the syntax is as follows −
insert into yourTableName values(yourValue1),(yourValue2),..........N;
To understand the above syntax, let us create a table −
mysql> create table DemoTable2022 -> ( -> Department varchar(100) -> ); Query OK, 0 rows affected (0.49 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable2022 values('Computer Science'),('Information Technology'), ('Civil'),('Mechanical'),('Electronics'),('Electrical'); Query OK, 6 rows affected (0.46 sec) Records: 6 Duplicates: 0 Warnings: 0
Display all records from the table using select statement −
mysql> select *from DemoTable2022;
This will produce the following output −
+---------------------------+ | Department | +---------------------------+ | Computer Science | | Information Technology | | Civil | | Mechanical | | Electronics | | Electrical | +---------------------------+ 6 rows in set (0.00 sec)
- Related Articles
- Insert multiple values in a temporary table with a single MySQL query?
- Fastest way to insert with multiple values in a single MySQL query?
- Insert multiple rows in a single MySQL query
- How to insert multiple rows with single MySQL query?
- Insert multiple sets of values in a single statement with MySQL?
- Get multiple count in a single MySQL query for specific column values
- A single MySQL query to search multiple words from different column values
- Inserting multiple parameter values into a single column with MySQL?
- How to set all values in a single column MySQL Query?
- Copy values of one column to another using INSERT and SELECT in a single MySQL query
- How to alter column type of multiple columns in a single MySQL query?
- Use LIKE % to fetch multiple values in a single MySQL query
- Insert all the values in a table with a single MySQL query separating records by comma
- How to insert an array of values in a MySQL table with a single INSERT?
- MySQL select and insert in two tables with a single query

Advertisements