You execute this EXPLAIN statement for a SELECT statement on the table named
comics.which contains 1183 rows:
Mysql> explain select comic_ title, publisher from comics where comic_title like ‘& Action&’;
1 row in set (0.00 sec)
You create the following index:
CREATE INDEX cimic_title_idx ON comics (comic_title, publisher);
You run the same EXPLAIN statement again;
Mysql > explain select comic_title ,publisher from comics where comic_title like ‘& Action&’;
1 row in the second SELECT statement need to read all 1183 rows in the index
comic_title_idx?
A.
Because comic_title is not the primary key
B.
Because a LIKE statement always requires a full tables scan
C.
Because comic _title is part of acovering index
D.
Because a wildcard character is at the beginning of the search word
The correct answer is D.
D is wrong because there is no wild character in the given statement. I tried and i think correct answer is C.
These questions and answers are all sorts of jacked up so there will be a lot of errors. So far the ‘&’ symbols seem to actually mean ‘%’ (wildcard symbol) at this site. I don’t know the real answer since I haven’t done it, but retry using the % instead of & and see what happens. I am curious myself, so if you want to post your work it would be much appreciated.
I agree with A. I mde a simple test with a table with 3 rows.
create table comics (comic_title char(20),publisher char(15),p_year int);
insert into comics value (“jack Action Chen”,”publisher_a”,1990), (“Michael Action Hello”,”publisher_b”,1991),(“Live Free World”,”publisher_c”,1992);
CREATE INDEX cimic_title_idx ON comics (comic_title, publisher);
————–
->explain select comic_title ,publisher from comics where comic_title like “%Action%”;
–> rows 3
->explain select comic_title ,publisher from comics where comic_title like “%Action”;
–> rows 3;
->explain select comic_title ,publisher from comics where comic_title like “Action”;
–> rows 1;
->explain select comic_title ,publisher from comics where comic_title like “Action%”;
–> rows 1;
I also tested with setting primary key and changing covering index. Only D reflect the number of rows.
I agree with D. Serious Mistakes.