
- 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 values in a temporary table with a single MySQL query?
Let us first create a table −
mysql> create temporary table DemoTable ( SerialNumber int ); Query OK, 0 rows affected (0.00 sec)
Insert some records in the table using insert command. Here, we are inserting multiple values in a temporary table −
mysql> insert into DemoTable values(1),(2),(3),(4),(5),(6),(7),(8); Query OK, 8 rows affected (0.00 sec) Records: 8 Duplicates: 0 Warnings: 0
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+--------------+ | SerialNumber | +--------------+ | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | | 7 | | 8 | +--------------+ 8 rows in set (0.00 sec)
- Related Articles
- Fastest way to insert with multiple values in a single MySQL query?
- How do I insert multiple values in a column with a single MySQL query?
- Insert multiple rows in a single MySQL query
- Insert all the values in a table with a single MySQL query separating records by comma
- Insert multiple sets of values in a single statement with MySQL?
- How to insert multiple rows with single MySQL query?
- How to insert an array of values in a MySQL table with a single INSERT?
- Use LIKE % to fetch multiple values in a single MySQL query
- Insert values from the first table to the second table using two SELECT statements in a single MySQL query
- MySQL select and insert in two tables with a single query
- Get multiple count in a single MySQL query for specific column values
- Multiple COUNT() for multiple conditions in a single MySQL query?
- Implement multiple COUNT() in a single MySQL query
- Change multiple columns in a single MySQL query?
- MySQL update multiple records in a single query?

Advertisements