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>
54 lines
2.8 KiB
HTML
54 lines
2.8 KiB
HTML
<a name="EN-US_TOPIC_0000001772696204"></a><a name="EN-US_TOPIC_0000001772696204"></a>
|
|
|
|
<h1 class="topictitle1">MODIFY (Modifying a Cloumn)</h1>
|
|
<div id="body8662426"><p id="EN-US_TOPIC_0000001772696204__en-us_topic_0000001657865538_en-us_topic_0000001385616046_en-us_topic_0214164523_p7574545962">MySQL uses the <strong id="EN-US_TOPIC_0000001772696204__en-us_topic_0000001657865538_en-us_topic_0000001385616046_b126485974831712">MODIFY</strong> keyword to change column data types and set <strong id="EN-US_TOPIC_0000001772696204__en-us_topic_0000001657865538_en-us_topic_0000001385616046_b48762387431712">NOT NULL</strong> constraints. DSC will perform adaptation based on GaussDB(DWS) features during migration.</p>
|
|
<p id="EN-US_TOPIC_0000001772696204__en-us_topic_0000001657865538_en-us_topic_0000001385616046_en-us_topic_0214164523_p8822521203711"><strong id="EN-US_TOPIC_0000001772696204__en-us_topic_0000001657865538_en-us_topic_0000001385616046_en-us_topic_0214164523_b20727929204011">Input</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001772696204__en-us_topic_0000001657865538_en-us_topic_0000001385616046_en-us_topic_0214164523_screen146478312316">CREATE TABLE IF NOT EXISTS `runoob_alter_test`(
|
|
`dataType0` varchar(100),
|
|
`dataType1` bigint,
|
|
`dataType2` bigint,
|
|
`dataType3` bigint
|
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
## A.
|
|
ALTER TABLE runoob_alter_test MODIFY dataType1 smallint;
|
|
|
|
## B.
|
|
ALTER TABLE runoob_alter_test MODIFY dataType1 smallint NOT NULL;
|
|
|
|
## C.
|
|
ALTER TABLE runoob_alter_test MODIFY dataType1 smallint NOT NULL FIRST;
|
|
|
|
## D.
|
|
ALTER TABLE runoob_alter_test MODIFY dataType1 smallint NOT NULL AFTER dataType3;</pre>
|
|
<p id="EN-US_TOPIC_0000001772696204__en-us_topic_0000001657865538_en-us_topic_0000001385616046_en-us_topic_0214164523_p1431826173714"><strong id="EN-US_TOPIC_0000001772696204__en-us_topic_0000001657865538_en-us_topic_0000001385616046_en-us_topic_0214164523_b11199142516406">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001772696204__en-us_topic_0000001657865538_en-us_topic_0000001385616046_en-us_topic_0214164523_screen173941613113">CREATE TABLE "public"."runoob_alter_test"
|
|
(
|
|
"datatype0" VARCHAR(400),
|
|
"datatype1" BIGINT,
|
|
"datatype2" BIGINT,
|
|
"datatype3" BIGINT
|
|
)
|
|
WITH ( ORIENTATION = ROW, COMPRESSION = NO )
|
|
NOCOMPRESS
|
|
DISTRIBUTE BY HASH ("datatype0");
|
|
|
|
-- A.
|
|
ALTER TABLE "public"."runoob_alter_test" MODIFY "datatype1" SMALLINT NULL DEFAULT NULL;
|
|
|
|
-- B.
|
|
ALTER TABLE "public"."runoob_alter_test" MODIFY "datatype1" SMALLINT NOT NULL;
|
|
|
|
-- C.
|
|
ALTER TABLE "public"."runoob_alter_test" MODIFY "datatype1" SMALLINT NOT NULL;
|
|
|
|
-- D.
|
|
ALTER TABLE "public"."runoob_alter_test" MODIFY "datatype1" SMALLINT NOT NULL;</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>
|
|
|