1. Create tables
DROP TABLE IF EXISTS `City`;
CREATE TABLE `City` (
`ID` int(11) NOT NULL auto_increment,
`Name` char(35) NOT NULL default '',
`CountryCode` char(3) NOT NULL default '',
`District` char(20) NOT NULL default '',
`Population` int(11) NOT NULL default '0',
PRIMARY KEY (`ID`)
) ENGINE=NDBCLUSTER DEFAULT CHARSET=latin1;
INSERT INTO `City` VALUES (1,'Kabul','AFG','Kabol',1780000);
INSERT INTO `City` VALUES (2,'Qandahar','AFG','Qandahar',237500);
INSERT INTO `City` VALUES (3,'Herat','AFG','Herat',186800);
2. Shell insert
#!/bin/bash
max=1000
for (( i=11; i <= $max; ++i ))
do
/usr/bin/mysql -uroot -p123456 -hA.A.A.B -e "use test; INSERT INTO City VALUES ($i,'Kabul','AFG','Kabol',1780000);"
done
Không có nhận xét nào:
Đăng nhận xét