Thursday 22 February 2018

Azure Data Lake – U-SQL – Creating Database and DB Object


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

);

 

Job Graph:


 

Hope you like it.

 

Posted by: MR. JOYDEEP DAS


5 comments:

  1. • 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

    ReplyDelete
  2. Hi 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

    ReplyDelete
  3. Heya! From the really wonderful truth you can have provided! You may have integrated receiving vital areas!Pshots

    ReplyDelete
  4. I 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

    ReplyDelete
  5. I 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