Professional Web Applications Themes

get the name of key - MySQL

Hi, can I get the name of the field of a known table using SQL? Thanks in advance Marco Righi...

Sponsored Links
  1. #1

    Default get the name of key

    Hi,
    can I get the name of the field of a known table using SQL?

    Thanks in advance
    Marco Righi
    Sponsored Links
    thinkmarco@yahoo.it Guest

  2. #2

    Default Re: get the name of key

    >can I get the name of the field of a known table using SQL?

    In MySQL, there are queries such as "describe tablename" and
    "show index from tablename". I don't know whether these are
    standard SQL or not. If you forgot the table name, there is
    "show tables".

    Gordon L. Burditt
    Gordon Burditt Guest

  3. #3

    Default Re: get the name of key

    [email]thinkmarcoyahoo.it[/email] wrote:
    > Hi,
    > can I get the name of the field of a known table using SQL?
    >
    > Thanks in advance
    > Marco Righi
    In addition to the SHOW TABLES and SHOW FIELDS commands,
    in MySQL 5 there is also the INFORMATION_SCHEMA database, from where
    you can get various database objects metadata.

    [url]http://dev.mysql.com/doc/refman/5.0/en/information-schema.html[/url]

    For example:
    SELECT
    column_name, data_type
    from
    information_schema.columns
    where
    table_schema = 'your_database_name'
    and
    table_name = 'your_table_name';

    ciao
    gmax

    P.S. If you are Italian, you may also post at free.it.comp.database.mysql

    --
    _ _ _ _
    (_|| | |(_|>< The Data Charmer
    _|
    [url]http://datacharmer.blogspot.com/[/url]
    Giuseppe Maxia Guest

  4. #4

    Default Re: get the name of key

    >
    > P.S. If you are Italian, you may also post at free.it.comp.database.mysql
    >
    Yes, I'm Italian. I'm using [url]www.mailgate.org[/url] where there is not
    free.it.comp.database.mysql...

    Grazie
    Marco
    thinkmarco@yahoo.it Guest

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139