Posted By: Anonymous
Is there a way to grab the columns name of a table in mysql?
You can use DESCRIBE:
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 group_concat(COLUMN_NAME) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'my_database' AND TABLE_NAME = 'my_table';
Answered By: Anonymous
- Reference — What does this symbol mean in PHP?
- How to remove MySQL completely with config and…
- Most efficient conversion of ResultSet to JSON?
- Rails wrong number of arguments error when…
- Should MySQL have its timezone set to UTC?
- Search for a string in all tables, rows and columns of a DB
- Simulating group_concat MySQL function in Microsoft…
- Reference - What does this regex mean?
- Log record changes in SQL server in an audit table
- Drop all the tables, stored procedures, triggers,…
- 'block in draw' rails 6 routes
- Select distinct values in each 150 columns of a table
- PHP parse/syntax errors; and how to solve them
- How do I count unique visitors to my site?
- Insert into not inserting for mysql
- Postgres: SQL to list table foreign keys
- GROUP_CONCAT ORDER BY
- getting error while updating Composer
- MySQL SELECT DISTINCT multiple columns
- Avoid creating new session on each axios request laravel
- Howto: Clean a mysql InnoDB storage engine?
- SQL query return data from multiple tables
- Execute a PHP script from another PHP script
- phpMyAdmin on MySQL 8.0
- Search for one value in any column of any table…
- Find a value anywhere in a database
- Search all tables, all columns for a specific value…
- Find a string by searching all tables in SQL Server…
- The mysql extension is deprecated and will be…
- UTF-8 all the way through
- How to check if a table exists in a given schema
- error: 'Can't connect to local MySQL server through…
- Get table names using SELECT statement in MySQL
- How do you parse and process HTML/XML in PHP?
- How to find foreign key dependencies in SQL Server?
- Need a row count after SELECT statement: what's the…
- How to use GROUP_CONCAT in a CONCAT in MySQL
- "Notice: Undefined variable", "Notice: Undefined…
- What's the best way to get the last element of an…
- ERROR 1698 (28000): Access denied for user…
- Convert a PHP script into a stand-alone windows executable
- JSON Dump a string surrounded by single quotes and…
- How to select rows from a DataFrame based on column values
- data.table vs dplyr: can one do something well the…
- Are PDO prepared statements sufficient to prevent…
- How can I fix MySQL error #1064?
- What are the undocumented features and limitations…
- How can I access a table column given as a variable?
- How do I install Java on Mac OSX allowing version switching?
- Oracle query to fetch column names
- How do I subquery SQLite inside a GROUP_CONCAT query?
- How do I fetch multiple columns for use in a cursor loop?
- Can not connect to amazon RDS from spring boot container app
- Show all tables inside a MySQL database using PHP?
- Can I concatenate multiple MySQL rows into one field?
- Homebrew install specific version of formula?
- Search All Fields In All Tables For A Specific Value…
- MySQL query to get column names?
- How to do group_concat on two fields in sqlite?
- MySQL (8.0.24 Community Server - GPL) does not…
- How do I extract data from JSON with PHP?
- How to use dynamic column names in an UPDATE…
- How do I import a .sql file in mysql database using PHP?
- PHP - Failed to open stream : No such file or directory
- MYSQL inserting rows with missing dates
- Laravel: PDOException: could not find driver
- How do I test to see if a line of a .txt exists or…
- How can I enable the MySQLi extension in PHP 7?
- T-SQL: Export to new Excel file
- insert a NOT NULL column to an existing table
- What is your most productive shortcut with Vim?
- How can I initialize a MySQL database with schema in…
- Htaccess: add/remove trailing slash from URL
- How can I find the product GUID of an installed MSI setup?
- PHP mysql insert date format
- Need to list all triggers in SQL Server database…
- Postgresql tables exists, but getting "relation does…
- List columns with indexes in PostgreSQL
- How to set root password to null
- Having trouble with my nav bar/header, It used to…
- How does PHP 'foreach' actually work?
- PHP7 : install ext-dom issue
- How to check for null/empty/whitespace values with a…
- Failed to authenticate on SMTP server error using gmail
- Multiple json from a database using php
- How to find the mysql data directory from command…
- How to take backup of a single table in a MySQL database?
- How to change the MySQL root account password on CentOS7?
- How to get the sizes of the tables of a MySQL database?
- java.sql.SQLException: Access denied for user…
- PreparedStatement IN clause alternatives?
- MySQL ERROR 1045 (28000): Access denied for user…
- MySQL server has gone away - in exactly 60 seconds
- How to update Python?
- How to add column if not exists on PostgreSQL?
- How can I execute PHP code from the command line?
- DROP Constraint without knowing the name
- Change collations of all columns of all tables in SQL Server
- In Oracle SQL, I would like to call a Oracle stored…