forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Yang, Tong <yangtong2@huawei.com> Co-committed-by: Yang, Tong <yangtong2@huawei.com>
53 lines
4.7 KiB
HTML
53 lines
4.7 KiB
HTML
<a name="mrs_01_1426"></a><a name="mrs_01_1426"></a>
|
|
|
|
<h1 class="topictitle1">CREATE TABLE As SELECT</h1>
|
|
<div id="body1595920210643"><div class="section" id="mrs_01_1426__s19dc8db6467e4f3baa9a662138ec23e8"><h4 class="sectiontitle">Function</h4><p id="mrs_01_1426__a38185df4acf44342944d97b25a811bfc">This command is used to create a CarbonData table by specifying the list of fields along with the table properties.</p>
|
|
</div>
|
|
<div class="section" id="mrs_01_1426__s50bc973493d048dca1b9796f3501b588"><h4 class="sectiontitle">Syntax</h4><p id="mrs_01_1426__ab6dc8da59ff04d7e9dedbe9cf587fe69"><b><span class="cmdname" id="mrs_01_1426__cmdname163157165718">CREATE TABLE</span></b><i><span class="varname" id="mrs_01_1426__vd069c2942ec04e1587051fb2274dca11"> [IF NOT EXISTS] [db_name.]table_name</span></i> <em id="mrs_01_1426__i4872191835914"><strong id="mrs_01_1426__b58721184592">STORED AS carbondata </strong></em><em id="mrs_01_1426__i103219715015">[TBLPROPERTIES (key1=val1, key2=val2, ...)] AS
|
|
select_statement;</em></p>
|
|
</div>
|
|
<div class="section" id="mrs_01_1426__sadc8a75e45a940489bdd3c8c56f13ab0"><h4 class="sectiontitle">Parameter Description</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="mrs_01_1426__t6b42300fff2840bfb056a544dc7668f6" frame="border" border="1" rules="all"><caption><b>Table 1 </b>CREATE TABLE parameters</caption><thead align="left"><tr id="mrs_01_1426__r3b448fea562d49e1a73cafd7b09c1dc9"><th align="left" class="cellrowborder" valign="top" width="24.060000000000002%" id="mcps1.3.3.2.2.3.1.1"><p id="mrs_01_1426__aaaf8be0fc53d4336a3cdae9b409856c2"><strong id="mrs_01_1426__b10568193333714">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="75.94%" id="mcps1.3.3.2.2.3.1.2"><p id="mrs_01_1426__aa188261f197f4d3c97698b26af1f2e8f"><strong id="mrs_01_1426__b633463410374">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="mrs_01_1426__r4979f315a68742dd9dc817c469f9b7bf"><td class="cellrowborder" valign="top" width="24.060000000000002%" headers="mcps1.3.3.2.2.3.1.1 "><p id="mrs_01_1426__a14edab7d5d4441a68efcc0df676211fd">db_name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.94%" headers="mcps1.3.3.2.2.3.1.2 "><p id="mrs_01_1426__a87ecf6a3cbb0403fa6140e8ac3b27cf7">Database name that contains letters, digits, and underscores (_).</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_1426__ra1ea2fa9c3bb407fa4527cbeff860b1d"><td class="cellrowborder" valign="top" width="24.060000000000002%" headers="mcps1.3.3.2.2.3.1.1 "><p id="mrs_01_1426__a21692ed3e5a0468f897f115e712de5ab">table_name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.94%" headers="mcps1.3.3.2.2.3.1.2 "><p id="mrs_01_1426__af1a35ab6f75d457fbb1041c02662b280">Table name of a database that contains letters, digits, and underscores (_).</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_1426__r8ff05ad7e7eb46c98852e4d1414d16a4"><td class="cellrowborder" valign="top" width="24.060000000000002%" headers="mcps1.3.3.2.2.3.1.1 "><p id="mrs_01_1426__ab4f11fa96d574add97720b7db2eb2e1a">STORED AS</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.94%" headers="mcps1.3.3.2.2.3.1.2 "><p id="mrs_01_1426__a15d1808305624e1d99339670b70ebdea">Used to store data in CarbonData format.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_1426__r6caa920b4fb742a9be4c1401ddef052f"><td class="cellrowborder" valign="top" width="24.060000000000002%" headers="mcps1.3.3.2.2.3.1.1 "><p id="mrs_01_1426__a5a974d6904554f65b40a81c47bcb73ff">TBLPROPERTIES</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.94%" headers="mcps1.3.3.2.2.3.1.2 "><p id="mrs_01_1426__adf528fdf98f3488f95ac2164f0a7f824">List of CarbonData table properties. For details, see <a href="mrs_01_1425.html#mrs_01_1425__s4539dafd333c46ae855caaa175609f60">Precautions</a>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="mrs_01_1426__section338418109212"><h4 class="sectiontitle">Precautions</h4><p id="mrs_01_1426__p664812212023">N/A</p>
|
|
</div>
|
|
<div class="section" id="mrs_01_1426__sf6bb4c6935b2460ca222e90c82356959"><h4 class="sectiontitle">Examples</h4><p id="mrs_01_1426__p1312962617318"><b><span class="cmdname" id="mrs_01_1426__cmdname1971817393104">CREATE TABLE</span></b> ctas_select_parquet <em id="mrs_01_1426__i181301626331"><strong id="mrs_01_1426__b1013062615314">STORED AS</strong></em> carbondata as select * from parquet_ctas_test;</p>
|
|
</div>
|
|
<div class="section" id="mrs_01_1426__sf6d4f1901bea490caaedcf2ad09d7400"><h4 class="sectiontitle">System Response</h4><p id="mrs_01_1426__abd1aa318b00e4fd8b37db0d0c9746755">This example will create a Carbon table from any Parquet table and load all the records from the Parquet table.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_1424.html">DDL</a></div>
|
|
</div>
|
|
</div>
|
|
|