Introduction
In this article we are trying to discuss about creation
of Database and DB Object. Hope it will be informative.
Scenario
What we are doing in this article is mentioned bellow:
1.
Create a Database in the name of “MyUSQLDb”.
2.
Create a Schema in the name of “AbcPvtLtd”.
3.
Create a Table in the name of “ItemRate”.
4.
Insert some records in the table objects.
CREATE Database
To Create Database
CREATE DATABASE IF NOT EXISTS MyUSQLDb;
To Drop a Database
DROP DATABASE IF EXISTS MyUSQLDb;
CREATE
Schema
To Create Schema
USE MyUSQLDb;
CREATE SCHEMA IF NOT EXISTS AbcPvtLtd;
To Drop Schema
USE MyUSQLDb;
DROP SCHEMA IF NOT EXISTS AbcPvtLtd;
CREATE
Table Object and Index
USE DATABASE MyUSQLDb; // DATABASE keyword is optional
USE SCHEMA AbcPvtLtd; // SCHEMA keyword is
required for schemas
CREATE TABLE IF NOT EXISTS ItemRate
(
ItemCode int,
ItemRate int,
INDEX idx_ItemCode CLUSTERED (ItemCode)
DISTRIBUTED BY HASH (ItemCode)
);
Insert
Records in Table
USE DATABASE MyUSQLDb; // DATABASE keyword is optional
USE SCHEMA AbcPvtLtd; // SCHEMA keyword is
required for schemas
INSERT INTO ItemRate
VALUES
(
101,
210
);
INSERT INTO ItemRate
VALUES
(
102,
120
);
INSERT INTO ItemRate
VALUES
(
103,
112
• Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updatingAzure Online Training Bangalore
ReplyDeleteHi friend, this kind of will be between the best articles or blog posts of which I’ve anytime observed; you may want incorporate further views within similar pattern. I’m even today expecting a number of intriguing views out of your element along with your potential publish.cannabis extraction business
ReplyDeleteHeya! From the really wonderful truth you can have provided! You may have integrated receiving vital areas!Pshots
ReplyDeleteI truly enjoy basically evaluating ones web sites. Basically prepared to express to an individual that you've got men and women as well as me personally who appreciate function. Surely an excellent publish. A sensible way to off for your requirements! The main points that you've got offered is very valuable.hemp cultivation extraction manufacturing
ReplyDeleteI truly enjoy basically evaluating ones web sites. Basically prepared to express to an individual that you've got men and women as well as me personally who appreciate function. Surely an excellent publish. A sensible way to off for your requirements! The main points that you've got offered is very valuable.Resin Coatings uk
ReplyDelete