0

Hey folks,
I am loading the database from the text file using load infile command,
what i wish to do is to delete last inserted data not just the last row i.e all the data i have loaded from text tile.I am working on MySQL.

Thanks in advance
Prankyrules

4
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by jazz_vill
0

You could empty an entire table using:

truncate `table_name`;

Or, have a quick look in the table and find the first and last id's for the data you want to delete and use:

delete * from `table_name` where `id` between 100 and 1000

Replacing `table_name` and the 100 and 1000 appropriately.

R.

0

You could empty an entire table using:

truncate `table_name`;

Or, have a quick look in the table and find the first and last id's for the data you want to delete and use:

delete * from `table_name` where `id` between 100 and 1000

Replacing `table_name` and the 100 and 1000 appropriately.

R.

Thanks for the reply.I really appreciate.I have one more doubt when we insert data into a table.Is is sorted automatically and then inserted or it just get appended at the bottom.
Thanks

prankyrules

0

well it depends if you have your primary key say UserID INT AUTO_INCREMENT then all new datas are appended
ex. if your last entry before you updated it is UserID = 100 then your new data entry should start with 101 to N where n = number of new data

0

Hey folks,
I am loading the database from the text file using load infile command,
what i wish to do is to delete last inserted data not just the last row i.e all the data i have loaded from text tile.I am working on MySQL.

Thanks in advance
Prankyrules

Why you are importing data if you want to delete that after importing? Am I taking it wrong?

0

maybe its for testing... i'm a newbie too and i always do test so i can understand more how these things work...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.