Sunday 11 December 2011

show tables

The show tables command lists the tables in the database you are using. In the example below:
  1. The show tables command is run on an empty database.
  2. A table is created.
  3. The show tables command is run again and the new table appears in the output.
  4. The table is dropped.
  5. The show tables command is run showing that the database is empty again.
mysql> show tables;
Empty set (0.00 sec)
 
mysql> create table andrews_table
    -> (col1 varchar(10));
Query OK, 0 rows affected (0.07 sec)
 
mysql> show tables;
+------------------+
| Tables_in_Andrew |
+------------------+
| andrews_table    |
+------------------+
1 row in set (0.00 sec)
 
mysql> drop table andrews_table;
Query OK, 0 rows affected (0.00 sec)
 
mysql> show tables;
Empty set (0.00 sec)
 
mysql>

No comments: