doc-exports/docs/dws/tool/dws_16_0176.html
Lu, Huayi 27019c2991 DWS TOOL 830.201 version
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>
2024-05-16 07:35:25 +00:00

33 lines
4.0 KiB
HTML

<a name="EN-US_TOPIC_0000001819416265"></a><a name="EN-US_TOPIC_0000001819416265"></a>
<h1 class="topictitle1">Databases</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_p8060118">In MySQL, <strong id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_b111279231710">DATABASE</strong> is a schema object, which is equivalent to the <strong id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_b65614802931710">SCHEMA</strong> of Oracle and GaussDB(DWS). DSC supports the following two scenarios:</p>
<ol id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_ol1736417294121"><li id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_li183641029171215">Database creation<p id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_p1855594731211"><a name="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_li183641029171215"></a><a name="en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_li183641029171215"></a><strong id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_b976081302111">Input</strong></p>
<pre class="screen" id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_screen169591514151515">create database IF NOT EXISTS dbname1 CHARACTER SET=utf8 COLLATE=utf8_unicode_ci;
create database IF NOT EXISTS dbname2;
drop database if exists dbname1;
drop database if exists dbname2;</pre>
<p id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_p11379175171517"><strong id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_b110517132114">Output</strong></p>
<pre class="screen" id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_screen15279195812187">CREATE SCHEMA "dbname1";
CREATE SCHEMA "dbname2";
DROP SCHEMA IF EXISTS "dbname1";
DROP SCHEMA IF EXISTS "dbname2";</pre>
</li><li id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_li432033715120">Database use<p id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_p14618341205"><a name="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_li432033715120"></a><a name="en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_li432033715120"></a><strong id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_b91701020192115">Input</strong></p>
<pre class="screen" id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_screen448564592010">drop database if exists test;
create database if not exists test;
use test;</pre>
<p id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_p1179214391201"><strong id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_b1262833192120">Output</strong></p>
<pre class="screen" id="EN-US_TOPIC_0000001819416265__en-us_topic_0000001657865574_en-us_topic_0000001432527917_en-us_topic_0214164420_screen1339248152014">DROP SCHEMA IF EXISTS "test";
CREATE SCHEMA "test";
SET CURRENT_SCHEMA = "test";</pre>
</li></ol>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_16_0118.html">Schema Objects and Data Definition Language (DDL)</a></div>
</div>
</div>