need query

Discussion in 'MySQL' started by lakshmi2007, Nov 13, 2007.

  1. #1
    i need query to display column names of table in sql
     
    lakshmi2007, Nov 13, 2007 IP
  2. drunnells

    drunnells Peon

    Messages:
    79
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If this is mysql you can do a describe on the table from your mysql client.. like:

    mysql> describe testtable

    And you'll get something like:

    +----------+--------------+------+-----+------------+-------+
    | Field | Type | Null | Key | Default | Extra |
    +----------+--------------+------+-----+------------+-------+
    | day | date | | PRI | 0000-00-00 | |
    | username | varchar(100) | | PRI | | |
    | domain | varchar(100) | | PRI | | |
    +----------+--------------+------+-----+------------+-------+
     
    drunnells, Nov 13, 2007 IP
  3. msaqibansari

    msaqibansari Peon

    Messages:
    84
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    DESCRIBE tablename;

    this will return all table informationn
     
    msaqibansari, Nov 15, 2007 IP