I have a csv file in that file there are more than 1 million data with 25 fields. I want to insert only 20 fields in mysql
Fields are :
CREATE TABLE dummy (
`accountnum` VARCHAR(30) NULL DEFAULT NULL,
`custnum` VARCHAR(30) NULL DEFAULT NULL,
`accttype` VARCHAR(5) NULL DEFAULT NULL,
`classcode` VARCHAR(5) NULL DEFAULT NULL,
`classdesc` VARCHAR(40) NULL DEFAULT NULL,
`transdate` DATE NULL DEFAULT NULL,
`transcode` VARCHAR(10) NULL DEFAULT NULL,
`transdirect` VARCHAR(5) NULL DEFAULT NULL,
`transamount` DOUBLE NULL DEFAULT NULL,
`acctopendate` DATE NULL DEFAULT NULL,
`balance` DOUBLE NULL DEFAULT NULL,
`cashin` DOUBLE(10,2) NULL DEFAULT NULL,
`cashout` DOUBLE(10,2) NULL DEFAULT NULL,
`aliencustomer` VARCHAR(3) NULL DEFAULT NULL,
`foreignflag` VARCHAR(3) NULL DEFAULT NULL,
`originator` VARCHAR(100) NULL DEFAULT NULL,
`benefactor` VARCHAR(100) NULL DEFAULT NULL,
`naicscode` VARCHAR(20) NULL DEFAULT NULL,
`relatedAccount` VARCHAR(30) NULL DEFAULT NULL,
`relatedCIF` VARCHAR(5) NULL DEFAULT NULL,
`country` VARCHAR(50) NULL DEFAULT NULL,
`transid` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`cid` INT(11) NULL DEFAULT '1838',
`createts` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
`datasetid` INT(11) NULL DEFAULT NULL,
`shortname` VARCHAR(500) NULL DEFAULT NULL
)
This is my sql table fields into that only I want to insert data in
accountnum, custnum, accttype, classcode, classdesc, transdate, transcode, transdirect, transamount, acctopendate, balance, cashin, cashout, aliencustomer, foreignflag, originator, benefactor, naicscode, relatedAccount, shortname.
in these fields i want to insert and when I will run the script particular that data i want get from the csv file.
Anyone please help me with the proper script how I can write a bash script in ubuntu?