forked from docs/doc-exports
Reviewed-by: Wagner, Fabian <fabian.wagner@t-systems.com> Co-authored-by: Ru, Li Yi <liyiru7@huawei.com> Co-committed-by: Ru, Li Yi <liyiru7@huawei.com>
28 lines
2.7 KiB
HTML
28 lines
2.7 KiB
HTML
<a name="ddm_08_0005"></a><a name="ddm_08_0005"></a>
|
|
|
|
<h1 class="topictitle1">INSERT</h1>
|
|
<div id="body1597045079930"><p id="ddm_08_0005__p8060118">INSERT is used to insert data into database objects.</p>
|
|
<div class="section" id="ddm_08_0005__section36113533417"><h4 class="sectiontitle">Common Syntax</h4><pre class="screen" id="ddm_08_0005__screen205301452162214">INSERT [INTO] tbl_name
|
|
[(col_name,...)]
|
|
{VALUES | VALUE} ({expr },...),(...),...
|
|
[ ON DUPLICATE KEY UPDATE
|
|
col_name=expr
|
|
[, col_name=expr] ... ]
|
|
OR
|
|
INSERT [INTO] tbl_name
|
|
SET col_name={expr | DEFAULT}, ...
|
|
[ ON DUPLICATE KEY UPDATE
|
|
col_name=expr [, col_name=expr] ... ]</pre>
|
|
</div>
|
|
<div class="section" id="ddm_08_0005__section1280014191938"><h4 class="sectiontitle">Syntax Restrictions</h4><ul id="ddm_08_0005__en-us_topic_0169506650_ul7325172223219"><li id="ddm_08_0005__li1349813438517">INSERT DELAYED is not supported.</li><li id="ddm_08_0005__li421716473512">Only INSERT statements that contain sharding fields are supported.</li><li id="ddm_08_0005__li141896616418">PARTITION syntax is not supported. Partitioned tables are not recommended.</li><li id="ddm_08_0005__li2243101572415">Setting <strong id="ddm_08_0005__b5260624194618">datetime</strong> to <strong id="ddm_08_0005__b143602384715">1582</strong> or any value smaller in INSERT statements is not supported.</li><li id="ddm_08_0005__li353015422376">INSERT cannot be used to insert sharding key value <strong id="ddm_08_0005__b14825205498">DEFAULT</strong>.</li><li id="ddm_08_0005__li61835420562">If you specify an auto-increment key value in an INSERT statement and execute it on a sharded table, the auto-increment key value of the inserted data entry changes. Auto-increment key values of data entries inserted subsequently will increase based on the first inserted data entry unless you specify a new auto-increment key value.</li><li id="ddm_08_0005__li1329212114352">Referencing a table column in function REPEAT of the VALUES statement is not supported, for example, INSERT INTO T(NAME) VALUES(REPEAT(ID,3)).</li></ul>
|
|
</div>
|
|
<div class="section" id="ddm_08_0005__section1884017577597"><h4 class="sectiontitle">Use Constraints</h4><ul id="ddm_08_0005__ul328719541792"><li id="ddm_08_0005__li162871541194">If the sharding key value in the INSERT statement is invalid, data is routed to database shard 0 or table shard 0 by default.</li><li id="ddm_08_0005__li92871054699">Do not use functions VERSION, DATABASE, or USER in the INSERT statement. When you execute such as functions, you may not obtain the expected results because its results depend on whether it pushed to data nodes for execution.</li></ul>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="ddm_08_0004.html">DML</a></div>
|
|
</div>
|
|
</div>
|
|
|