This article mainly describes the correct operation steps for MySQL to INSERT data, including how to use the INSERT statement correctly to INSERT records and how to view the data in the table
because of the work of the project needs to settle a batch of the same batch number of data inserted into a table, and then through another page to show, so you need to insert a batch of data at once, so the use of SqlBulkCopy insert a batch of data1 Public Static intInsert
transaction processing. InnoDB table engine shutdown MySQL Automatic transaction submission can greatly improve the efficiency of data insertion, because if you need to insert 1000 data, MySQL will automatically initiate (commit)
MySQL Insert/Update dataINSERT Statement1. List the values of all fields at once, for example:INSERT INTO student VALUES ('chenqi','M', $); INSERT INTO Student VALUES ('Bush',' m', ', '), (' Obama'm ', 45);Allows multiple rows of data to be inserted simultaneously;2. Assign values only to partial fieldsINSERT into stu
',' submission_date ' date default NULL,PRIMARY KEY (' tutorial_id '),UNIQUE KEY ' Author_index ' (' Tutorial_author ')) Type=innodb1 row in Set (0.00 sec)ERROR:No query specified
Step 2:Rename this table and create another table
The code is as follows
Copy Code
mysql> CREATE TABLE
Label:Keywords: SQL Server, table data, build INSERT statementFeedback please contact: [Email protected]Brief introductionDatabase data generates an INSERT (MSSQL version), which generates an INSERT or update SQL script for the
Use JDBC to quickly insert data in batches in MySQL database bitsCN.com
When you use JDBC to connect to the MySQL database for data insertion, especially continuous insertion of large volumes of data (10 W +), How to improve effic
For transaction TABLES, BEGIN and COMMIT should be used instead of lock tables to speed up insertion. Locking also reduces the overall time for multi-connection testing, although the maximum wait time for them to wait for LOCK will increase. For example:
Connection 1 does 1000 inserts Connections 2, 3, and 4 do 1 insert Connection 5 does 1000 inserts
If no lock is used, 2, 3, and 4 are completed before 1 and 5. If locking is used, 2, 3, and 4 may not
MySQL stored procedures insert data in cycles bitsCN.com when testing machines, the absolute values of inset and alert are often tested, so a stored procedure is written to complete.
Drop procedure if exists proc_buildata;
Tudou @ Gyyx
Create procedure proc_buildata (IN loop_times INT)
BEGIN
DECLARE var int default 0;
Prepare msql from 'create
: date and time, for example, '2017-01-02 12:23:43'TimeStamp: timeStamp, which is automatically assigned to the current date and time. Create an employee tableCreatetable employee (id int, name varchar (20), sex bit, birthday date, salarydouble, entry_date date, resume text );* View:View all tables:Showtables;View the statement for creating a specified tableShowcreate table employee;Mysql
This requires the orderly insertion function of an ascending sequential table to be implemented. L is an ascending sequential order table, where the function status listinsert_sortedsq (SqList l, Elemtype e) is used to insert a data in an ascending order in the order table.
, ' FORD ', ' ANALYST ', 7566, ' 1981-12-3 ', 3000,null,20); EMP VALUES (7934, ' MILLER ', ' clerk ', 7782, ' 1982-1-23 ', 1300,null,10); Insert_salgrade.sql /* Function: Insert database The initial data time for table Salgrade in Scott: Thursday, December 18, 2014 20:16:09 CST Small code */insert into Salgrade VALUE
if;
End loop dd;
End; $
Mysql> delimiter;
Mysql> call test;
Result
Mysql> call test; Query OK, 0 rows affected (58 min 30.83 sec)
Very time-consuming.
So I found another method.
Use PHP code to generate data and then import the data:
The Code is as follows:
$ T = mktime
There are several ways to insert data into a table in Oracle:Assuming the table name is userThe first method: Select T.*,rowid from User t;--> Click on the key to add data to the tableThe second method: Select T.*,rowid from the User t for update;--> Click on the key tag to
Insert is used to insert new rows into an existing table. INSERT ... The values statement inserts a row based on an explicitly specified value. Let's take a look at the definition of the INSERT statement standard, which can be omitted in []:
Grammar
1 Data Source 200w
2 Use the data from the external table to load, import data 1) Create a directory with another DBA user and authorize the directory to the current user (if created with this user, then report ORA-29400: Error opening file D:\XX.log with Data plugin erro
delete all rows of data and want to keep the sequence number information, you can use a delete command with a where toTo suppress MySQL optimizations:Delete from table_name where 1;This will force MySQL to perform the evaluation of the conditional expression once for each deleted data row.Force
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.