首页 分享 Describe

Describe

来源:花匠小妙招 时间:2025-08-16 01:42

Describe

Describing a Table

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

Describing a Query

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.

Using DESCRIBE in a Subquery

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);

Describing Remote Tables

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 指令一招搞定电商出图 – Midjourney 实战必杀技
雅思口语Part 2话题卡:Describe an important event that you celebrated 庆祝的重要事件
python 清洗数据
赠花一般情况要赠送鲜花,尽量不要用干花、纸花或者是发蔫凋零的花送人;探望病人,可
Nature综述:免疫系统到底如何应对真菌感染?
口腔生理学术语B
研究发现植物能为人减压 Plants reduce stress, study finds
雅思口语Part 1答题模板:花鸟鱼虫
雅思口语Part 2话题卡:庆祝的重要事件
爱词霸

网址: Describe https://www.huajiangbk.com/newsview2265349.html

所属分类:花卉
上一篇: 生鲜农产品出村,如何跑好“最先一
下一篇: 达实受邀出席2023AI安防与智

推荐分享