4Oct/110
Delete Duplicate Rows In Mysql With PHP
$dupq = mysql_query("SELECT * FROM `db`"); $dups = mysql_fetch_array($dupq); foreach($dups as $dup){ mysql_query("DELETE FROM db WHERE duplicate_COLUMN='".$dup['duplicate_column']."' AND id!='".$dup['id']."'"); }
duplicate_COLUMN - Name of column and $dup['column_name'] delete duplicates which include same column data.
13Mar/100
MySQL: How to add column to existing table
Definition: Add column is used to add an additional column to any given table. You must specify the column name, and type. It is written as alter table add column [new column name]
Examples:
ALTER TABLE `tablename_here` ADD `new_column_name` VARCHAR( 255 ) NOT NULL ;
or
ALTER TABLE `tablename_here` ADD `new_column_name` INT NOT NULL AFTER `existing_column`;