To make this topic 'more complete'.
I required the column names and data types on a SELECT statement (not a table).
If you want to do this on a SELECT statement instead of an actual existing table, you can do the following:
DROP TABLE IF EXISTS abc;
CREATE TEMPORARY TABLE abc AS
-- your select statement here!
SELECT
*
FROM foo
-- end your select statement
;
select column_name, data_type
from information_schema.columns
where table_name = 'abc';
DROP IF EXISTS abc;
Short explanation, it makes a (temp) table of your select statement, which you can 'call' upon via the query provided by (among others) @a_horse_with_no_name and @selva.
Hope this helps.