Learning Mysql



Download 4.24 Mb.
View original pdf
Page271/366
Date04.08.2023
Size4.24 Mb.
#61806
1   ...   267   268   269   270   271   272   273   274   ...   366
Learning MySQL
Exercises
1. 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
and
INSERT
IGNORE
?
Exercises | 295


4. 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 inset sec. What can you tell from this output produced by the
EXPLAIN
command?
+-----+--------------+------------+--------+---------------+---------+---------+...
| id | select_type | table | type | possible_keys | key | key_len |...
+-----+--------------+------------+--------+---------------+---------+---------+...
| 1 | PRIMARY | played | index | PRIMARY | PRIMARY | 10 |...
| 1 | PRIMARY | track | eq_ref | PRIMARY | PRIMARY | 6 |...
| 2 | UNION | played | index | PRIMARY | PRIMARY | 10 |...
| 2 | UNION | track | eq_ref | PRIMARY | PRIMARY | 6 |...
| NULL UNION RESULT | | ALL | | | |...
+-----+--------------+------------+--------+---------------+---------+---------+...
...+--------------------------------------------------------------------+------+...
...| ref | rows |...
...+--------------------------------------------------------------------+------+...
...| | 12 |...
...| music.played.artist_id,music.played.album_id,music.played.track_id | 1 |...
...| | 12 |...
...| music.played.artist_id,music.played.album_id,music.played.track_id | 1 |...
...| | NULL |...
...+--------------------------------------------------------------------+------+...
...+-----------------------------+
...| Extra |
...+-----------------------------+
...| Using index Using filesort |
...| |
...| Using index Using filesort |
...| |
...| |
...+-----------------------------+
5 rows inset sec)

Download 4.24 Mb.

Share with your friends:
1   ...   267   268   269   270   271   272   273   274   ...   366




The database is protected by copyright ©ininet.org 2024
send message

    Main page