Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

Create table mysql

0

50 views

Hello all,

I'am new to mysql and i want to know what KEY (not primary key) means in the query below :

    CREATE TABLE `users` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL default '',
  `username` varchar(150) NOT NULL default '',
  `email` varchar(100) NOT NULL default '',
  `password` varchar(100) NOT NULL default '',
  `activation` varchar(100) NOT NULL default '',
  PRIMARY KEY  (`id`),
  KEY `idx_name` (`name`),
  KEY `username` (`username`),
  KEY `email` (`email`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=65 ;

also this line ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=65 ;

asked April 15, 2011 3:12 am CDT
posted via StackOverflow

3 Answers

1
 

A KEY is an index: it's just like a library index: quicker finding for the values of that colum. You want this for joining and searching.

ENGINE=MyISAM 

Means the engine you use (this is the default). If you need foreign keys for example, then you might want InnoDB.

DEFAULT CHARSET=utf8 

Is the default character set.

AUTO_INCREMENT=65 ;

Means that currently the auto-increment value is at 65.

answered April 15, 2011 3:23 am CDT
0
 

KEY is a synonym for INDEX. See database index if you're not familiar with them.

answered April 15, 2011 3:23 am CDT
0
 

It is a index key use for foreign key relationship with other tables.

answered April 15, 2011 3:23 am CDT

Your answer

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect

Preview
Similar questions
MySQL create table
April 13, 2011