Maybe not the whole world is wrong, maybe I am wrong, but the problem is wrong

Source: Internet
Author: User

The previous time received a friend's e-mail, recommended to participate in a forum of the answer activity.
Active Address: http://bbs.phpthinking.com/thread-305-1-1.html
The final result is a wrong answer, and the forum in charge of discussion, and was accused of "impossible the whole world is wrong, you are right."
Cause the mood is very bad, had to run 51 to spit a trough. The
now sends the wrong question:
The "Radio" user table creates a normal index for the field name (varchar type), and the following query statement can use the index?
A. SELECT * from users where name is not in (' A ', ' B ');
B. SELECT * from the users where name like '%a% ';
C. SELECT * from users where name between ' a ' and ' B ';
D. SELECT * from the users where name = age;
According to the analysis, we generally choose c ha.
In most cases, Test1:
Create TABLE user (
ID int (one) auto_increment,
name varchar () not NULL,
PRIMARY key (ID )
);
ALTER TABLE user add index Idx_name (name);
and insert a few data, explain4 the option to find that only C is the "perfect" answer.

However, this topic does not mention the existence of other fields, nor does it specify whether other primary keys are allowed to be created, and whether other fields and primary keys will affect the test results?
Next, let's do test2:
CREATE table User2 (
name varchar () not null
);
ALTER TABLE User2 add index idx_name (name);
Continue explain ...


All right, dear friends, after testing, you will find that a-c even use the index, of course, d as always the grammatical error.
The person in charge has emphasized to me how the C is correct in most cases, but I would like to say that it is sufficient to prove that a problem is problematic and that only one counter-example is needed.
Finally, learned that the topic is still a well-known company's face test, the issue of the person is through the million annual salary manager's hand.
I think, a company, the spirit of respect for the interview attitude, or the first perfect under the topic it!
----answer is generally true for most people, and truth is often in the hands of a few.

Maybe not the whole world is wrong, maybe I am wrong, but the problem is wrong

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.