Hi,
please help me in solving this. Please show me some approach to dealt with.
I have a excel/csv file contains these feilds:
Company
Address1
Address2 + Address3
City
State
ZIP Code
Phone Number
SIC_Code,
SECTION_Head,
Number Of Employees,
Name (First & Last Name)
Now my task is to convert this info in to two tables..
companies:
company_id int(10) NOT NULL auto_increment,
company_module int(10) NOT NULL default '0',
company_name varchar(100) default '',
company_industry varchar(100) default NULL,
company_phone1 varchar(30) default '',
company_phone2 varchar(30) default '',
company_fax varchar(30) default '',
company_address1 varchar(50) default '',
company_address2 varchar(50) default '',
company_city varchar(30) default '',
company_state varchar(30) default '',
company_zip varchar(11) default '',
company_country_code char(3) default 'USA',
company_primary_url varchar(255) default '',
company_creator int(11) NOT NULL default '0',
company_owner int(11) NOT NULL default '0',
company_private tinyint(3) unsigned NOT NULL default '0',
company_description text NOT NULL,
company_type int(3) NOT NULL default '0',
company_email varchar(255) default NULL,
company_custom longtext,
creation_date date NOT NULL default '0000-00-00',
last_update_date date NOT NULL default '0000-00-00',
last_updated_by int(11) NOT NULL default '0',
PRIMARY KEY (company_id),
KEY idx_co (company_name),
KEY idx_owner (company_owner),
FULLTEXT KEY company_description (company_description)
) TYPE=MyISAM AUTO_INCREMENT=6 ;
The feilds from csv ******
Company
Address1
Address2 + Address3
City
State
ZIP Code
Phone Number
{SIC_Code,
SECTION_Head,
Number Of Employees,} These three will go as one feild company description.
These will go into the companies table (above one)
and other table is contacts :
contact_prefix char(3) NOT NULL default 'mr',
contact_first_name varchar(30) default NULL,
contact_last_name varchar(30) default NULL,
contact_order_by varchar(30) NOT NULL default '',
contact_title varchar(50) default NULL,
contact_birthday datetime default NULL,
contact_company_id int(10) default '0',
contact_company varchar(100) default NULL,
contact_department tinytext,
contact_type varchar(20) default NULL,
contact_email varchar(255) default NULL,
contact_email2 varchar(255) default NULL,
contact_phone varchar(30) default NULL,
contact_phone2 varchar(30) default NULL,
contact_fax varchar(30) default NULL,
contact_mobile varchar(30) default NULL,
contact_address1 varchar(30) default NULL,
contact_address2 varchar(30) default NULL,
contact_city varchar(30) default NULL,
contact_state varchar(30) default NULL,
contact_zip varchar(11) default NULL,
contact_country varchar(30) default NULL,
contact_icq varchar(20) default NULL,
contact_notes text,
contact_project int(11) NOT NULL default '0',
contact_icon varchar(20) default 'obj/contact',
contact_creator int(11) NOT NULL default '0',
contact_owner int(10) unsigned default '0',
contact_private tinyint(3) unsigned default '0',
creation_date date NOT NULL default '0000-00-00',
last_update_date date NOT NULL default '0000-00-00',
last_updated_by int(11) NOT NULL default '0',
PRIMARY KEY (contact_id),
KEY idx_oby (contact_order_by),
KEY idx_co (contact_company),
KEY idx_prp (contact_project)
These will goto contacts table how to make this happen.
Company
Address1
Address2 + Address3
City
State
ZIP Code
Phone Number
Name (First & Last Name)
please help me in solving this. Please show me some approach to dealt with.
sharma