© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies


Data Manipulation Language (DML) and Data Control Language (DCL) commands in RDBMS

Data Manipulation Language
DML that allows to manipulate the data, to update to change it, to select subsets according to defined criteria and to present the data to the user.

INSERT

INSERT is used to add new records to the table.

SQL> insert into courses values ('Java', 40, 50, 1000);

1 row created.

SQL>
SELECT
      SELECT command retrieves rows from the database and allows the selection of one or many rows or columns from one or many tables.

SQL> select name from courses;

NAME
--------------------
C programming
XML programming
Java programming
Java

SQL>
WHERE Clause
      Used to display selected rows from a table based on condition.

SQL> select name, duration from courses where  name like '%programming%';

NAME                   DURATION
-------------------- ----------
C programming                20
XML programming              10
Java programming             30

UPDATE
            The UPDATE statement changes Data in Existing Rows in a Table. The UPDATE statement can be used to modify the contents of single rows, group of rows or all the rows of a table.

SQL> update courses set name='visual programming' where ccode=50;

1 row updated.

SQL>

DELETE

DELETE statement is used to remove specific rows from a table or all rows from a table.

SQL> delete from courses where ccode=50;

1 row deleted.

SQL>
Truncate Table

            TRUNCATE table statement removes all rows from a table. TRUNCATE table is always faster than DELETE statement.

SQL> truncate table courses;

Table truncated.

SQL>

Data Control Language

            The DML language statements Insert, Delete, Update are affected i.e., written in the database unless the user specially says so. The command for this is

SQL> commit;

Commit complete.

SQL>
This will commit (write to database) the transactions done by the DML.

In after inserting, updating or deleting the transactions the user does not want to commit the changes, then the user can rollback the transaction using the command:

SQL> rollback;

Rollback complete.

SQL>
It will rollback the transaction and will not commit the changes to the database.

 
SLogix Student Projects

⇓Student Projects⇓
⇑Student Projects⇑
bottom