There is a need to obtain all the fields (in the form of collections) of the data table. When querying online, group_concat
the function databases may not support this function, such as presto sql .
Therefore, it can be obtained in the following way:
select array_join(array_agg(col), ',')
from(
select t.column_name as col
from information_schema.columns t
where t.table_name = '表名'
)
Among them, all field information can be obtained from the query, which is a column named col, array_agg()
which is converted into an array form through a function, and then array_join()
all fields can be obtained by splicing.