How to export some rows of a MySQL table with where clause? I have a MySQL say test and I want to create a importable .sql file for rows where id are between 10 and 100. The way is to use mysqldump feature of MySQL server. |
This is the command which will export few rows (for my case where id>=1 and id<=10) into a file: c:\xampp\mysql\bin\mysqldump.exe -uroot DatabaseName TableName --where="id>=1 and id<=10" > c:\Users\HP\Downloads\Export.sql |
You can also use the –where flag to selectively dump data from more than one table, but obviously the columns specified in the where clause need to be in both tables LIKE c:\xampp\mysql\bin\mysqldump.exe -uroot DatabaseName TableName1 TableName2 --where="id>=1 and id<=10" > c:\Users\HP\Downloads\Export.sql |
Pages
▼
No comments:
Post a Comment