BASIC OPERATION CREATE , INSERT, UPDATE AND DELETE IN SQL.

Abhishek Srivasatava

Total Post:70

Points:350
Posted by  Abhishek Srivasatava
 334  View(s)
Ratings:
Rate this:
  1. Abhishek Srivasatava

    Post:70

    Points:350
    Basic operation CREATE , INSERT, UPDATE and DELETE in SQL.

    How to create table?

     

    Table can be form by 2 ways:

     

    Programming method and manual method.

     

    Programming Method

     

      Example : CREATE TABLE EE_EMPL_CAT
    ( PRSN_INTN_ID  int NOT NULL PRIMARY KEY ,
    EMPL_STAT_CD char(20)  NOT NULL ,
    NAME  char(10,
    REFERENCE_ID int,
    );

     

    2nd method is the manual method. You need to follow following step.

     

    Under database à under Table section right click on table point to new table.

    Name the Column Name like ee_intn_id etc, datatype, check or unchecked the ‘Allow Null’ column. 

    Save the table.

    For putting constraint on your table read this Cluster and non-cluster index in SQL and Different types of Constraints in SQL.

     

    How to insert data into the table?

     

    Below is the syntax to insert.

    INSERT INTO EE_EMPL_CAT1 (PRSN_INTN_ID, [EMPL_STAT_CD],[NAME],REFERENCE_ID)
        VALUES (1199667, 'ACTIVE', 'DAVID',159978)

     

    How to Update data into the table?

     

    Below is the syntax to Update.

     
    UPDATE EE_EMPL_CAT1
        SET NAME = 'SMITH'
        WHERE PRSN_INTN_ID = 1199668


    How to delete the data from the table?


    Below is the syntax to Delete:

     DELETE FROM EE_EMPL_CAT1
        WHERE NAME = 'DAVID'
        

      Modified On Sep-27-2016 07:15:38 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!