![]() ![]() ('Q002','EM001','All the topics in a particular course handled by the trainer without any gaps or slippages'), ('Q001','EM001','Instructor knowledgeable and able to handle all your queries'), ('A001','Miss.','GAYATHRI NARAYANAN','Gurgaon','Java','Bachelor of MOHAN','Kerala','Java','Bachelor of Engineering In Information SRINIVAS','Chennai','Java','Bachelor of Engineering In RANGANATHAN','Mumbai','DotNet','Master of Computer MENON','Kerala','Mainframe','Bachelor of Engineering In Information KRISHNAN','Pune','Testing','Master of Computer SHUNMUGHAM','Mumbai','Java','Bachelor of * from Associate_Info ('B006','MRS.SUSAN CHERIAN','RETAIL & HOSPITALITY'), ('F001','Mr.','PANKAJ GHOSH','Pune','Java','Bachelor of RADHAKRISHNAN ','Bangalore','DotNet','Bachelor of MATHUR','Chennai','Mainframe','Bachelor of NAIR','Kolkata','Java','Master of Computer PAREKH','Hyderabad','Testing','Master of Computer AGRAWAL' ,'Mumbai','Mainframe','Bachelor of KULKARNI','Coimbatore','Testing','Bachelor of MENON' ,'Mumbai','Java','Master of Science In Information * from Trainer_Info Here, student_unique_index is the index name assigned to student_id and creates an index for which values must be unique (here null can be accepted).įulltext option ALTER TABLE `tbl_student` ADD FULLTEXT student_fulltext_index (`student_id`)Ībove statement will create the Fulltext index name with student_fulltext_index, for which you need MyISAM Mysql Engine.Insert into Trainer_Info (Trainer_Id,Salutation,Trainer_Name,Trainer_Location,Trainer_Track,Trainer_Qualification,Trainer_Experiance,Trainer_Email,Trainer_Password) Specify index name ALTER TABLE `tbl_student` ADD INDEX student_index (`student_id`)Ībove statement will create an ordinary index with student_index name.Ĭreate unique index ALTER TABLE `tbl_student` ADD UNIQUE student_unique_index (`student_id`) Indexes of two types can be added: when you define a primary key, MySQL will take it as index by default.Ĭonsider you have a tbl_student table and you want student_id as primary key: ALTER TABLE `tbl_student` ADD PRIMARY KEY (`student_id`)Ībove statement adds a primary key, which means that indexed values must be unique and cannot be NULL. It might be helpful to note that I've just taken a look, and ID field is stored as INT whereas the PRODUCT_ID field is stored as VARCHAR. | 1 | SIMPLE | table | ALL | NULL | NULL | NULL | NULL |157211 | Using where | My full EXPLAIN results are: | id | select_type | table | type | possible_keys| key | key_len | ref | rows | Extra | An EXPLAIN query reveals that there is no index for the product_id field when I've already added one, and as a result the query takes any where from 20 minutes to 30 minutes to return a single row. This field was not previously indexed however, I've added one, so mysql now indexes the field, but when I try to run the above query, it runs very slowly. For example: SELECT * FROM table WHERE product_id = '1' However, for a recent development in the project, I have to search the database by another field. The code runs fine as the ID field is the primary index. Currently, when I try and run SELECT * FROM table WHERE id = '1' I've got a very large MySQL table with about 150,000 rows of data. ![]()
0 Comments
Leave a Reply. |