Can DESCRIBE syntax be embedded in SELECT statement?
You can use COLUMNS table of INFORMATION_SCHEMA to get expected result as an alternate solution of DESCRIBE table option.
Try this:
SELECT COLUMN_NAME AS `Field`, COLUMN_TYPE AS `Type`, IS_NULLABLE AS `NULL`, COLUMN_KEY AS `Key`, COLUMN_DEFAULT AS `Default`, EXTRA AS `Extra`FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'schemaName' AND TABLE_NAME = 'table1';
The output of DESCRIBE
looks like a table, but DESCRIBE
is not actually a query and thus cannot be treated as, for example, a subquery in a SELECT statement.