forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
35 lines
2.5 KiB
HTML
35 lines
2.5 KiB
HTML
<a name="EN-US_TOPIC_0000001819336213"></a><a name="EN-US_TOPIC_0000001819336213"></a>
|
|
|
|
<h1 class="topictitle1">LIKE (Table Cloning)</h1>
|
|
<div id="body8662426"><p id="EN-US_TOPIC_0000001819336213__en-us_topic_0000001706224145_en-us_topic_0000001436175737_en-us_topic_0214164665_p17157194614820">MySQL databases support <strong id="EN-US_TOPIC_0000001819336213__en-us_topic_0000001706224145_en-us_topic_0000001436175737_b86363034631911">CREATE TABLE</strong>. <strong id="EN-US_TOPIC_0000001819336213__en-us_topic_0000001706224145_en-us_topic_0000001436175737_b96084084931911">LIKE</strong> is a method with which a table is created by cloning the old table structure, It is also supported by GaussDB(DWS). DSC will add additional table attribute information during migration.</p>
|
|
<p id="EN-US_TOPIC_0000001819336213__en-us_topic_0000001706224145_en-us_topic_0000001436175737_en-us_topic_0214164665_p66158450506"><strong id="EN-US_TOPIC_0000001819336213__en-us_topic_0000001706224145_en-us_topic_0000001436175737_en-us_topic_0214164665_b177164592506">Input</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001819336213__en-us_topic_0000001706224145_en-us_topic_0000001436175737_en-us_topic_0214164665_screen194633114518">CREATE TABLE IF NOT EXISTS `public`.`runoob_tbl_old`(
|
|
`dataType_1` YEAR,
|
|
`dataType_2` YEAR(4),
|
|
`dataType_3` YEAR DEFAULT '2018',
|
|
`dataType_4` TIME DEFAULT NULL
|
|
);
|
|
|
|
CREATE TABLE `runoob_tbl` (like `runoob_tbl_old`);</pre>
|
|
<p id="EN-US_TOPIC_0000001819336213__en-us_topic_0000001706224145_en-us_topic_0000001436175737_en-us_topic_0214164665_p8060118"><strong id="EN-US_TOPIC_0000001819336213__en-us_topic_0000001706224145_en-us_topic_0000001436175737_en-us_topic_0214164665_b137575215519">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001819336213__en-us_topic_0000001706224145_en-us_topic_0000001436175737_en-us_topic_0214164665_screen0945151925117">CREATE TABLE IF NOT EXISTS "public"."runoob_tbl_old"
|
|
(
|
|
"datatype_1" SMALLINT,
|
|
"datatype_2" SMALLINT,
|
|
"datatype_3" SMALLINT DEFAULT '2018',
|
|
"datatype_4" TIME WITHOUT TIME ZONE DEFAULT NULL
|
|
)
|
|
WITH ( ORIENTATION = ROW, COMPRESSION = NO )
|
|
NOCOMPRESS
|
|
DISTRIBUTE BY HASH ("datatype_1");
|
|
|
|
CREATE TABLE "public"."runoob_tbl"( LIKE "public"."runoob_tbl_old"
|
|
INCLUDING COMMENTS INCLUDING CONSTRAINTS INCLUDING DEFAULTS INCLUDING INDEXES INCLUDING STORAGE);</pre>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_16_0119.html">Table (Optional Parameters and Operations)</a></div>
|
|
</div>
|
|
</div>
|
|
|