doc-exports/docs/dws/tool/dws_07_8312.html
Lu, Huayi 346ac31da9 DWS TG 8.1.3.200 VERSION
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Reviewed-by: Jiang, Beibei <beibei.jiang@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2023-08-28 09:20:17 +00:00

33 lines
3.5 KiB
HTML

<a name="EN-US_TOPIC_0000001188681086"></a><a name="EN-US_TOPIC_0000001188681086"></a>
<h1 class="topictitle1">Databases</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001188681086__en-us_topic_0238518450_en-us_topic_0237362328_en-us_topic_0214164420_p8060118">In MySQL, <strong id="EN-US_TOPIC_0000001188681086__en-us_topic_0237712327_b528616615552">DATABASE</strong> is a schema object, which is equivalent to the <strong id="EN-US_TOPIC_0000001188681086__en-us_topic_0237712327_b172861761554">SCHEMA</strong> of Oracle and <span id="EN-US_TOPIC_0000001188681086__text10892754124514">GaussDB(DWS)</span>. DSC supports the following two scenarios:</p>
<ol id="EN-US_TOPIC_0000001188681086__en-us_topic_0238518450_en-us_topic_0237362328_en-us_topic_0214164420_ol1736417294121"><li id="EN-US_TOPIC_0000001188681086__en-us_topic_0238518450_en-us_topic_0237362328_en-us_topic_0214164420_li183641029171215">Database creation<p id="EN-US_TOPIC_0000001188681086__en-us_topic_0238518450_en-us_topic_0237362328_en-us_topic_0214164420_p1855594731211"><a name="EN-US_TOPIC_0000001188681086__en-us_topic_0238518450_en-us_topic_0237362328_en-us_topic_0214164420_li183641029171215"></a><a name="en-us_topic_0238518450_en-us_topic_0237362328_en-us_topic_0214164420_li183641029171215"></a><strong id="EN-US_TOPIC_0000001188681086__en-us_topic_0237712327_b1728786125519">Input</strong></p>
<pre class="screen" id="EN-US_TOPIC_0000001188681086__en-us_topic_0238518450_en-us_topic_0237362328_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_0000001188681086__en-us_topic_0238518450_en-us_topic_0237362328_en-us_topic_0214164420_p11379175171517"><strong id="EN-US_TOPIC_0000001188681086__en-us_topic_0237712327_b1628717615515">Output</strong></p>
<pre class="screen" id="EN-US_TOPIC_0000001188681086__en-us_topic_0238518450_en-us_topic_0237362328_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_0000001188681086__en-us_topic_0238518450_en-us_topic_0237362328_en-us_topic_0214164420_li432033715120">Database use<p id="EN-US_TOPIC_0000001188681086__en-us_topic_0238518450_en-us_topic_0237362328_en-us_topic_0214164420_p14618341205"><a name="EN-US_TOPIC_0000001188681086__en-us_topic_0238518450_en-us_topic_0237362328_en-us_topic_0214164420_li432033715120"></a><a name="en-us_topic_0238518450_en-us_topic_0237362328_en-us_topic_0214164420_li432033715120"></a><strong id="EN-US_TOPIC_0000001188681086__b1200422904">Input</strong></p>
<pre class="screen" id="EN-US_TOPIC_0000001188681086__en-us_topic_0238518450_en-us_topic_0237362328_en-us_topic_0214164420_screen448564592010">drop database if exists test;
create database if not exists test;
use test;</pre>
<p id="EN-US_TOPIC_0000001188681086__en-us_topic_0238518450_en-us_topic_0237362328_en-us_topic_0214164420_p1179214391201"><strong id="EN-US_TOPIC_0000001188681086__b384713661">Output</strong></p>
<pre class="screen" id="EN-US_TOPIC_0000001188681086__en-us_topic_0238518450_en-us_topic_0237362328_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_sct_0013.html">MySQL Syntax Migration</a></div>
</div>
</div>