I do have a table with more than 100000 data elements, but there are almost 350 blank rows within. How do I delete this blank rows using phpmyadmin? Manually deleting is a tedious task.
相关问题
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- php PDO::FETCH_ASSOC doesnt detect select after ba
- sqlyog export query result as csv
I am doing the
mysql
operation in command prompt in windows. And the basic queries:and
doesn't work. I don't know whether it works in
phpmyadmin
sqlcommand builder. Anyway:works fine.
I have a PHP script that automatically removes empty rows based on column data types.
That allows me to define "emptiness" differently for different column types.
e.g.
Since "0" values are meaningless in my system, I count them as empty. But I found out that if you do (
first_name
= 0) then you will always get true, because strings always == 0 in MySQL. So I tailor the definition of "empty" to the data type.I know this has already been answered and has got a tick, but I wrote a small function for doing this, and thought it might be useful to other people.
I call my function with an array so that I can use the same function for different tables.
and here is the function which takes the array and builds the delete string
You can use this function for multiple tables. You just need to send in a different table name and array and it will work.
My function will check for a whole row of empty columns or NULL columns at the same time. If you don't need it to check for NULL then you can remove that part.
The general answer is:
or
See: http://dev.mysql.com/doc/refman/5.0/en/delete.html
More info when you post your tables!~
Also, be sure to do:
before you delete, so you can see which rows you are deleting! I think in phpMyAdmin you can even just do the select and then "select all" and delete, but I'm not sure. This would be pretty fast, and very safe.
This procedure will delete any row for all columns that are null ignoring the primary column that may be set as an ID. I hope it helps you.
Execute the procedure like this.