Αποτελέσματα Αναζήτησης
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:
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.
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.
Displaying MySQL Column Names and Values via PHP. Sometimes in a PHP page it may be useful to not only retrieve data values from a MySQL database table, but also to retrieve column names from the table. Listed below is an example of how to do this for MySQL databases using PHP.
29 Σεπ 2011 · To make sure you list columns in a table in the current database, use the DATABASE() or SCHEMA() function. It returns NULL if you are not in a current database. This query will show the columns in a table in the order the columns were defined:
SHOW COLUMNS displays information about the columns in a given table. It also works for views. SHOW COLUMNS displays information only for those columns for which you have some privilege. mysql> SHOW COLUMNS FROM City; +-------------+----------+------+-----+---------+----------------+.
11 Ιουν 2024 · In MySQL, The SHOW TABLES command is used to list the tables in a specific database. It provides a simple way to see the tables that exist within a database without having to query the database schema directly.