Αποτελέσματα Αναζήτησης
6 Οκτ 2009 · You can use DESCRIBE: DESCRIBE my_table; Or in newer versions you can use INFORMATION_SCHEMA: 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; Or to get column names with comma in a line:
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.
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;
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.
22 Ιαν 2009 · To get a list of columns for a table, use the DESCRIBE SQL statement. The syntax is as follows: DESCRIBE TableName. To get a list of tables on the database, use this SQL statement: SHOW TABLES. edited Jan 22, 2009 at 9:02. answered Jan 22, 2009 at 8:56.
7 Ιουλ 2015 · SELECT COLUMNS.COLUMN_NAME FROM information_schema.COLUMNS WHERE COLUMNS.table_schema='yourschema' and TABLE_NAME='yourtable' ORDER BY COLUMNS.ORDINAL_POSITION LIMIT 3;