Giorgi Margiani
Giorgi Margiani

Reputation: 302

How can I get DML syntax from existing tables in MySQL?

I have several tables in MySQL database and those tables are already filled;

Is there any way to get DML, which fills tables with same name, with exact same data?

for ex. if I have table (names) like this:

name_id : 1
name_val : john
name_id : 2
name_val : jack

I want to get this kind of DML :

Insert into table names(name_id,name_val) values(1,'john');
Insert into table names(name_id,name_val) values(2,'jackn');

Upvotes: 0

Views: 1373

Answers (1)

peterm
peterm

Reputation: 92795

You can utilize mysqldump

To get only data use --no-create-info parameter

mysqldump -u user -p[password] --no-create-info --compact db_name table_name > dump.sql

Upvotes: 1

Related Questions