Exercises
Write the monitor command to import the file academics.tsv, which has its values separated by tabs, into the
details
table. Hint: the tab character is shown with the\t
escape sequence.When would you need to insert data using a query?
What’s the difference between
REPLACE
andINSERT
IGNORE
?What can you tell from this output produced by the
EXPLAIN
command?+----+-------------+------------+-------+---------------+---------+... | id | select_type | table | type | possible_keys | key |... +----+-------------+------------+-------+---------------+---------+... | 1 | SIMPLE | supervisor | const | PRIMARY | PRIMARY |... | 1 | SIMPLE | student | ALL | NULL | NULL |... | 1 | SIMPLE | supervises | index | NULL | PRIMARY |... +----+-------------+------------+-------+---------------+---------+... ... +---------+-------+------+------------------------------------+ ... | key_len | ref | rows | Extra | ... +---------+-------+------+------------------------------------+ ... | 4 | const | 1 | Using index; Using temporary | ... | NULL | NULL | 95 | | ... | 12 | NULL | 570 | Using where; Using index; Distinct | ... +---------+-------+------+------------------------------------+ 3 rows in set (0.00 sec)
What can you tell from this output produced by the
EXPLAIN
command?+-----+--------------+------------+--------+---------------+---------+---------+... | id | select_type | table | type | possible_keys | key | key_len |... +-----+--------------+------------+--------+---------------+---------+---------+... ...
Get Learning MySQL now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.