enroll needs to be a key.one page loads based on when ppl joined (enrolled)mysql> CREATE TABLE users(
-> uid int unsigned NOT NULL auto_increment PRIMARY KEY,
-> username varchar(15) NOT NULL UNIQUE KEY,
-> password varchar(15) NOT NULL,
-> email tinytext NOT NULL UNIQUE KEY,
-> gmt_offset tinyint default '-5' NOT NULL,
-> site_access tinyint unsigned default '0' NOT NULL,
-> admin_comment tinytext,
-> approved tinyint unsigned default '12' NOT NULL,
-> last_login_ip tinytext NOT NULL,
-> last_login_date datetime default '0000-00-00 00:00:00' NOT NULL,
-> end_level date default '0000-00-00' NOT NULL,
-> login_duration tinyint default '0' NOT NULL,
-> enroll datetime default '0000-00-00 00:00:00' NOT NULL KEY,
-> gender char(1) default 'F' NOT NULL KEY,
-> last_activity datetime default '0000-00-00 00:00:00' NOT NULL
-> ) TYPE=MyISAM;
ERROR 1064: You have an error in your SQL syntax near 'KEY,
gender char(1) default 'F' NOT NULL KEY,
last_activity datetime default '00' at line 14
mysql>
declaring a key "inline"
Moderator: General Moderators
declaring a key "inline"
Umm, what do you mean by a key that doesn't need to be unique???
I'll admit I'm clueless about MySQL, so if its some nonstandard concept it uses I'll be useless, but the very notion of a key in database systems implies uniqueness....
A key is a collection of columns (possibly/normally a single column) that can uniquely identify a row in the host table. What else could a key mean?
I'll admit I'm clueless about MySQL, so if its some nonstandard concept it uses I'll be useless, but the very notion of a key in database systems implies uniqueness....
A key is a collection of columns (possibly/normally a single column) that can uniquely identify a row in the host table. What else could a key mean?
the oplain use of key in mysql is synonymouswith index. what sql sets a faster way to search by so that it's more efficient.. i'm trying to make all those that are likely to be used often set as keys o that it will index them.
unique keys can only have one item in that row with that value, but can be null unless otherwise stated. primary keys are unique keys that cannot be null
unique keys can only have one item in that row with that value, but can be null unless otherwise stated. primary keys are unique keys that cannot be null
according to phpmyadmin:
and also
Code: Select all
ALTER TABLE `table` ADD INDEX ( `thing` )Code: Select all
CREATE TABLE `sdfadf` (
`a` TINYINT( 2 ) NOT NULL ,
`b` TINYINT( 2 ) NOT NULL ,
PRIMARY KEY ( `a` ) ,
INDEX ( `b` )
);