in reply to Querying and parsing MySQL data types

You mentioned "COLUMNS from information_schema", but you can get the same info with a little simpler syntax:
mysql> SHOW COLUMNS FROM student LIKE 's%';
+------------+------------------+------+-----+---------+----------------+
| Field      | Type             | Null | Key | Default | Extra          |
+------------+------------------+------+-----+---------+----------------+
| sex        | enum('F','M')    | NO   |     | NULL    |                |
| student_id | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
+------------+------------------+------+-----+---------+----------------+
I suppose that doesn't help much, because you still have to parse out all the stuff in 'Type' and 'Extra'.
  • Comment on Re: Querying and parsing MySQL data types

Replies are listed 'Best First'.
Re^2: Querying and parsing MySQL data types
by LanX (Saint) on Nov 30, 2018 at 22:35 UTC
    Thanks, TIMTOWTDI and I tried most of them:

    DESCRIBE t_tm1_export_import_attributes;

    Field Type Null Key Default Extra
    f_node_id int(10) unsigned NO PRI
    f_transfertype enum('export','import') NO export
    f_cube varchar(100) NO cubename
    f_active enum('Y','N') NO Y
    f_checkposliste enum('0','1') NO 0
    f_kumulativ enum('0','1') NO 0
    f_bstdimnr int(11) NO 0
    f_file varchar(300) NO
    f_info varchar(300) NO

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice