Archive for the ‘MySQL’ Category
Monday, January 24th, 2011
1. Instead of VARCHAR, BLOB or TEXT, Use CHAR type when possible. if values of a column have constant length: MD5-hash (32 symbols), ICAO or IATA airport code (4 and 3 symbols), BIC bank code (3 symbols), etc. Data in CHAR type columns can be found faster rather than in ...
Posted in MySQL, Others | No Comments »
Monday, January 24th, 2011
Here we are assuming that we have a table with given structure:
[sql]
CREATE TABLE teasttable (
prkey int(11) NOT NULL auto_increment,
names varchar(20),
score int,
timeEnter timestamp(14),
PRIMARY KEY (prkey)
);
[/sql]
Posted in MySQL, Others | No Comments »
Friday, January 21st, 2011
Does the order of the columns or fields in a create table statement make a difference? Well the answer for this is YES !!!
[sql]
create table testing (
a int,
b int,
UpdateTime timestamp,
EnterTime timestamp );
[/sql]
Posted in MySQL, Others | No Comments »
Wednesday, January 19th, 2011
In mysql, you can merge several tables into one using MERGE UNION, but the fields should be same in each table
[sql]
CREATE TABLE `test1` (
`pkey` int(11) NOT NULL,
`a` int(11) NOT NULL,
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`pkey`),
UNIQUE KEY `a` (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
mysql> insert into test1 (a,b,c) values (11,12,13);
[/sql]
Posted in MySQL, Others | No Comments »
Wednesday, January 19th, 2011
Assume that we have a table with given structure and data.
[sql]
CREATE TABLE IF NOT EXISTS testing(
pid int(11) NOT NULL auto_increment,
a int,
b int,
c int,
PRIMARY KEY (pid)
);
[/sql]
Posted in MySQL, Others | No Comments »