faqts : Computers : Programming : Languages : Sql

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

8 of 8 people (100%) answered Yes
Recently 8 of 8 people (100%) answered Yes

Entry

Database: Language:SQL:MySql:Table:Field:Operation:View: How to view structure of fields in a table?

Apr 4th, 2005 09:40
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 04 April 2005 - 11:48 pm ----------------------

Database: Language:SQL:MySql:Table:Field:Operation:View: How to view 
structure of fields in a table?

---

Use the command

 USE <your database name>

 SHOW FIELDS FROM <your tablename in that database>

---
---

e.g.

--- cut here: begin --------------------------------------------------

mysql> USE test1;

Database changed

mysql> SHOW TABLES;

+-----------------+
| Tables_in_test1 |
+-----------------+
| dddtablename    |
| table1          |
| table2          |
| table3          |
| table4          |
| table5          |
| tablename       |
| tablestudy      |
+-----------------+
8 rows in set (0.00 sec)

mysql> SHOW FIELDS FROM tablename;

+--------------+-------------+------+-----+---------+----------------+
| Field        | Type        | Null | Key | Default | Extra          |
+--------------+-------------+------+-----+---------+----------------+
| columnNumber | int(11)     |      | PRI | NULL    | auto_increment |
| columnName   | varchar(50) | YES  |     | NULL    |                |
+--------------+-------------+------+-----+---------+----------------+

2 rows in set (0.00 sec)

--- cut here: end ----------------------------------------------------

---
---

Internet: see also:

---

Database: Language: SQL: Overview: Can you give an overview of links 
about SQL?
http://www.faqts.com/knowledge_base/view.phtml/aid/32811/fid/54

----------------------------------------------------------------------