phpsharma Posted September 12, 2013 Share Posted September 12, 2013 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 More sharing options...
dragon_girl Posted September 12, 2013 Share Posted September 12, 2013 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. 2 Link to comment Share on other sites More sharing options...
HartleySan Posted September 13, 2013 Share Posted September 13, 2013 That's it. Thanks for sharing the answer with everyone. Link to comment Share on other sites More sharing options...
phpsharma Posted September 13, 2013 Author Share Posted September 13, 2013 Thank you..Great answer..and I like the page reference. Keep up the good work.. Thanks, sharma Link to comment Share on other sites More sharing options...
Recommended Posts