Examine table with EXPLAIN : EXPLAIN « Command MySQL « SQL / MySQL






Examine table with EXPLAIN

      
mysql>
mysql> CREATE TABLE IF NOT EXISTS backpacks
    -> (
    ->   id INT AUTO_INCREMENT PRIMARY KEY,
    ->   make VARCHAR(8), model VARCHAR(25), price DECIMAL(6,2)
    -> );
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql>
mysql>
mysql> EXPLAIN backpacks;
+-------+--------------+------+-----+---------+----------------+
| Field | Type         | Null | Key | Default | Extra          |
+-------+--------------+------+-----+---------+----------------+
| id    | int(11)      | NO   | PRI | NULL    | auto_increment |
| make  | varchar(8)   | YES  |     | NULL    |                |
| model | varchar(25)  | YES  |     | NULL    |                |
| price | decimal(6,2) | YES  |     | NULL    |                |
+-------+--------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

mysql>
mysql> # delete this sample table
mysql> DROP TABLE IF EXISTS backpacks;
Query OK, 0 rows affected (0.00 sec)

mysql>

   
    
    
    
    
    
  








Related examples in the same category

1.Understand the EXPLAIN statement
2.Null check