SQL

Data Manipulation Language – Introduction

Data Manipulation Language (DML):This Language is used to manipulate the data in the database like inserting data, updating data and deleting data. It Contains 3 commands, they are
    1. insert.
    2. update
    3. Delete

1. Insert:This command is used to insert data into the table in a database. To insert data into the table, we have two methods.
    (i). Implicit Insertion(SYSTEM).
    (ii). Explicit Insertion(USER).

(i). Implicit Insertion(SYSTEM):By using implicit insertion, we must enter all columns data into a table in a database otherwise, it would show error.
syntax:SQL>insert into <Table_Name> values(<col1>, <col2>, <col3>, ……);
Example:insert into student values(1101,’Miller’, ‘Pune’, 25000);

(ii). Explicit Insertion(USER):By using explicit insertion, we can enter our required columns data into a table in database.
syntax:SQL>insert into <Table_Name>(<col1>, <col2>, <col3>, ……) values(<col1>, <col2>, <col3>, ……);
Example:insert into student(sno, sname, sfee) values(1104, ‘Jones’, 26000);

Syntax to insert the values continuously into a table
Some times, we haveto insert values continuously into a table. For inserting multiple records, we should use a special operators, they are
    (i). & (Single Ampersand)
    (ii). && (double Ampersand)

(i). & (Single Ampersand)This special operator helps to repeat the value one time.
syntax of implicit insertion:SQL>insert into <Table_Name> values(&<col1>,& <col2>, &<col3>, ……);

syntax of Explicit insertionSQL>insert into <Table_Name>(<col1>, <col2>, <col3>, ……) values(&<col1>,& <col2>, &<col3>, ……);

(ii). && (Double Ampersand)This special operator helps to repeat the value more than one time.
syntax of implicit insertion:SQL>insert into <Table_Name> values(&&<col1>,&& <col2>, &&<col3>, ……);

syntax of Explicit insertionSQL>insert into <Table_Name>(<col1>, <col2>, <col3>, ……) values(&&<col1>,&&<col2>, &&<col3>, ……);

2. update:This command is used to update all rows at a time and also a specific row by using where condition.
syntax:update <Table_Name> set <col1>= <value>, <col2>= <value>, …..[where (condition)];

3. Delete:This command is used to delete all rows at a time and also specific record from a table in database.
syntax to specific record:delete from <Table_Name> [where (condition)];

syntax to all records:delete from <Table_Name>;

About the author

karunakar

I completed the M.TECH, am enthusiastic to finding the gadgets & learning new things.

Add Comment

Click here to post a comment