I am using mysql workbench (SQL Editor). I need copy the list of columns in each query as was existed in Mysql Query Browser.
For example
Select * From tb
I want have the list of fields like as:
id,title,keyno,……
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You mean you want to be able to get one or more columns for a specified table?
1st way
Do
SHOW COLUMNS FROM your_table_nameand from there on depending on what you want have some basic filtering added by specifying you want only columns that data type is int, default value is null etc e.g.SHOW COLUMNS FROM your_table_name WHERE type='mediumint(8)' ANDnull='yes'2nd way
This way is a bit more flexible and powerful as you can combine many tables and other properties kept in MySQL’s INFORMATION_SCHEMA internal db that has records of all db columns, tables etc. Using the query below as it is and setting TABLE_NAME to the table you want to find the columns for
To limit the number of matched columns down to a specific database add
AND TABLE_SCHEMA='your_db_name'at the end of the queryAlso, to have the column names appear not in multiple rows but in a single row as a comma separated list you can use
GROUP_CONCAT(COLUMN_NAME,',')instead of onlyCOLUMN_NAME