Hey guys, what is the code to delete all the records(rows) in a table? I only know the drop table 'table_name' command.
How to delete all the rows in a table
Page 1 of 17 Replies - 751 Views - Last Post: 09 October 2012 - 10:12 AM
Replies To: How to delete all the rows in a table
#2
Re: How to delete all the rows in a table
Posted 09 October 2012 - 09:47 AM
You can use 'DELETE' with no 'where' clause..
https://dev.mysql.co.../en/delete.html
or.. truncate.
https://dev.mysql.co...cate-table.html
https://dev.mysql.co.../en/delete.html
or.. truncate.
https://dev.mysql.co...cate-table.html
#3
Re: How to delete all the rows in a table
Posted 09 October 2012 - 09:50 AM
So i can do something like:
... and it will clean my table?
Nevermind I tried it and it works. Thank you!
DELETE FROM "table_name"
... and it will clean my table?
Nevermind I tried it and it works. Thank you!
This post has been edited by clee06: 09 October 2012 - 09:52 AM
#4
Re: How to delete all the rows in a table
Posted 09 October 2012 - 09:51 AM
Yup... what happens when you run it?
#5
Re: How to delete all the rows in a table
Posted 09 October 2012 - 10:00 AM
#6
Re: How to delete all the rows in a table
Posted 09 October 2012 - 10:02 AM
Well.. yeah. That's the point - it deletes the rows. Why would you need it to delete the columns as well?
#7
Re: How to delete all the rows in a table
Posted 09 October 2012 - 10:10 AM
#8
Re: How to delete all the rows in a table
Posted 09 October 2012 - 10:12 AM
Yup.. delete is fine but if you get in to giant quantities of data you may find 'truncate' works a bit faster.. but's a whole mess of data.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote







|