Database Languages
SQL has proved
to be a very effective language for heavy databases. The following are the
capabilities of SQL.
1. Data Definition Language (DDL).
2. Data Manipulation Language (DML).
DDL: DDL provides commands for creating
objects (tables, views, functions, indexes, procedures etc) in a database. The
CREATE, DROP, ALTER are the important commands for SQL as DDL. Following is the
list of DDL commands
¨ Create:
To create objects
¨ Alter:
To alter the objects created by create statement.
¨ Drop:
To delete the obsolete object
¨ Rename:
To rename the objects
¨ Grant:
To allow the user to have privileges
¨ Revoke:
To withdraw or change what you have granted to user
¨ Comment:
To add a comment in data dictionary
DML:
Once the table has been created in oracle, DML statements help us to manipulate
or change the data. These commands are most frequently used (mostly used)
¨ Delete:
Remove the rows from table[ do yourself]
¨ Insert:
To add a new row in table
¨ Select:
To show the rows in table in different format and queries.
¨ Update:
To change the contents of one, some or all rows of a table.
TCL or DCL:
These commands manage the changes made by DML statements & they are
¨ Commit: To save the changes permanently in the table
after changes in table.
¨ Rollback:
To get the table in previous state when some DML commands has been given by
mistake or on the wrong object.
¨ Savepoint:
Set the point up to which the rollback command is to work.
¨ Set transaction:
Establish properties of a transaction.
Embedded SQL:
All the sql statements, DML statements, DDL statements and DCL commands can be grouped
into a one body. This group can be created by applying special SQL statements -
these SQL statements are known as Embedded SQL statements. When this body is
executed then all the statements in body will automatically executed. For
example a user defined function is the best example of E SQL, which may
contains a SQL statement, commit, and rollback or update commands. Some of the
E SQL statements are :
¨ Define :
Define cursors
¨ Open :
Open cursors
¨ Declare:
To declare variable types and assign value to them.
¨ Execute :
To execute commands on SQL prompt
¨
Fetch:
To read rows from a cursor.
No comments:
Post a Comment