Jump to content
Larry Ullman's Book Forums

Chapter -17 Index Login (Username, Pass)


Recommended Posts

Hi Great day,

 

can anyone explain me this line of code ... "INDEX login(username, pass)" in the below query

 

*************************************************************************

CREATE TABLE users (

user_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,

lang_id TINYINT UNSIGNED NOT NULL,

time_zone VARCHAR(30) NOT NULL,

username VARCHAR(30) NOT NULL,

pass CHAR(40) NOT NULL,

email VARCHAR(60) NOT NULL,

PRIMARY KEY(user_id),

UNIQUE (username),

UNIQUE (email),

INDEX login(username, pass)

);

**********************************************************

 

Thanks in advance,

sharma

Link to comment
Share on other sites

Go back to page 179 in the book. It states that the index name is optional. When indexing multiple columns, in this case username and password, separate them by commas and put them in order of importance. So all you're doing is indexing 2 columns at once and giving this multiple index a name of login.

  • Upvote 2
Link to comment
Share on other sites

 Share

×
×
  • Create New...