Αποτελέσματα Αναζήτησης
6 Οκτ 2009 · select column_name from information_schema.columns where table_schema = 'my_database' and table_name = 'my_table'; Or you can use SHOW COLUMNS : SHOW COLUMNS FROM my_table;
8 Οκτ 2018 · Use SHOW COLUMNS syntax to show the columns of the table in MySQL. Use INFORMATION_SCHEMA to select and get column names from a table in MySQL using PHP. Specify the TABLE_SCHEMA to select a table of a specific database.
Select Data From a MySQL Database. The SELECT statement is used to select data from one or more tables: SELECT column_name (s) FROM table_name. or we can use the * character to select ALL columns from a table: SELECT * FROM table_name. To learn more about SQL, please visit our SQL tutorial.
18 Νοε 2012 · I always get something like this (this is what I think is the best answer): SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`='yourdatabasename' AND `TABLE_NAME`='yourtablename';
To get the column names of a table in PHP MySQL, you can use the mysqli_fetch_fields() function. This function returns an array of objects containing the column names.
To show the columns of a table, you specify the table name in the FROM clause of the SHOW COLUMNS statement. To show columns of a table in a database that is not the current database, you use the following form: SHOW COLUMNS FROM database_name.table_name; Code language: SQL (Structured Query Language) (sql) Or.
29 Σεπ 2011 · This query will show the columns in a table in the order the columns were defined: SELECT column_name,column_type FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name='table' ORDER BY ordinal_position;