Describe
In order to view the schema of a table, use the DESCRIBE statement (or its aliases DESC and SHOW) followed by the table name.
CREATE TABLE tbl (i INTEGER PRIMARY KEY, j VARCHAR); DESCRIBE tbl; SHOW tbl; -- equivalent to DESCRIBE tbl; column_name column_type null key default extra i INTEGER NO PRI NULL NULL j VARCHAR YES NULL NULL NULL
In order to view the schema of the result of a query, prepend DESCRIBE to a query.
DESCRIBE SELECT * FROM tbl; column_name column_type null key default extra i INTEGER YES NULL NULL NULL j VARCHAR YES NULL NULL NULL
Note that there are subtle differences: compared to the result when describing a table, nullability (null) and key information (key) are lost.
DESCRIBE can be used a subquery. This allows creating a table from the description, for example:
CREATE TABLE tbl_description AS SELECT * FROM (DESCRIBE tbl);
It is possible to describe remote tables via the httpfs extension using the DESCRIBE TABLE statement. For example:
DESCRIBE TABLE 'https://blobs.duckdb.org/data/Star_Trek-Season_1.csv'; column_name column_type null key default extra season_num BIGINT YES NULL NULL NULL episode_num BIGINT YES NULL NULL NULL aired_date DATE YES NULL NULL NULL cnt_kirk_hookups BIGINT YES NULL NULL NULL cnt_downed_redshirts BIGINT YES NULL NULL NULL bool_aliens_almost_took_over_planet BIGINT YES NULL NULL NULL bool_aliens_almost_took_over_enterprise BIGINT YES NULL NULL NULL cnt_vulcan_nerve_pinch BIGINT YES NULL NULL NULL cnt_warp_speed_orders BIGINT YES NULL NULL NULL highest_warp_speed_issued BIGINT YES NULL NULL NULL bool_hand_phasers_fired BIGINT YES NULL NULL NULL bool_ship_phasers_fired BIGINT YES NULL NULL NULL bool_ship_photon_torpedos_fired BIGINT YES NULL NULL NULL cnt_transporter_pax BIGINT YES NULL NULL NULL cnt_damn_it_jim_quote BIGINT YES NULL NULL NULL cnt_im_givin_her_all_shes_got_quote BIGINT YES NULL NULL NULL cnt_highly_illogical_quote BIGINT YES NULL NULL NULL bool_enterprise_saved_the_day BIGINT YES NULL NULL NULL
相关知识
雅思口语话题:Describe a healthy lifestyle you know.
剑桥雅思真题4Test2口语Part2答案范文Describe an interest or hobby that you enjoy 兴趣爱好
形容身体好的英语
Understanding Chinese medicine terminology
如何用英语表达各种“胖”和“瘦”?慎用哦!
100 Common Health Expressions for Everyday Conversations
郭月琴
Sodexo Dietitians Talk Sustainable Eating and Wellness
Loneliness: Causes, Coping With It, and Getting Help
What We Say Matters: The Power of Words in American and Indigenous Histories
网址: Describe https://m.trfsz.com/newsview1683322.html