1

I'm using terminal for mysql

I want to know what column my table has, but it's empty and dont show anything to me

  • Show Databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test               |
+--------------------+
  • Use test

Database changed

  • Show Tables;
+----------------+
| Tables_in_test |
+----------------+
| tblPerson      |
| tblStudent     |
+----------------+

What Should I do to see the column of my table, even if its empty, like this:

+----+-----------------+---------+
| id | name            | is_male |
+----+-----------------+---------+
|    |                 |         |
+----+-----------------+---------+

not this:

Empty set (0.00 sec)
Ali Rn
  • 748
  • 7
  • 17

3 Answers3

4

Type this command you will get the column names of your table.

desc tblPerson;
Kaleemullah
  • 174
  • 8
2

You can use describe, of course. You can also use information_schema.columns. Or, you can just select:

select p.*
from tblPerson p
limit 0;
Gordon Linoff
  • 1,198,228
  • 53
  • 572
  • 709
1

Show table structure: describe [table]; or desc [table];

Manish Sharma
  • 133
  • 1
  • 10