Anda di halaman 1dari 3

1) DATA DEFINITION LANGUAGE (DDL) STATEMENTS DDL statements are used to define, alter or drop database objects.

The commands used are: -

CREATE ALTER Drop

: It is Used to create table having rows and columns : It is Used to alter the structure of the table or database : It is Used to remove entire table i.e. rows and columns

(Indexes and privileges are removed, it cannot be rollback and Trigger operations cannot be performed in drop command) RENAME : It is used to rename a table or an object of database Allocated for the records are removed (Truncate is the fastest way of deleting even triggers operation cannot be Performed and it cannot be rolled back) 2) DATA MANIPULATION LANGUAGE (DML) STATEMENTS DML statements enable users to query or manipulate data in existing objects. DML statements are normally the most commonly used commands. The commands used are: Truncate : It is used to delete all records from a table, including all spaces

DELETE: Delete removes rows from the database. (Delete commands can be rollback, Triggers can be fired where There is Delete Trigger operation)

INSERT: it adds new rows of data to database objects. UPDATE: it updates values in existing rows and columns of table.

3) DATA CONTROL LANGUAGE (DCL) STAEMENTS


The SQL sentences used to control the behavior of objects are called data control statements. The commands used are: GRANT: Grant statements provide users access to a database REVOKE: Revoke statement is used to deny or withdraw access to grant command

4) TRANSACTION CONTROL LANGUAGE (TCL) STATEMENTS


TCL statements are used to manage the change made by DML statements and provide statements to be grouped together in logical transaction. The SQL statements used to control various transactions are called transaction control statement. The commands used are: COMMIT : It is used to save the changes permanently. so that later it can roll back.

ROLLBACK : It is used to provide a checkpoint to transaction

5) DATA RETRIEVAL STATEMENT Data Retrieval statement is used to view the information from a table or database. The command used is:SELECT: It is used to get the data from a table. Select statement is a Query based command.

6) CONSTRAINTS Constraints are the set of rules used to limit the type of data given in a table. Different types of constraints are: i. PRIMARY KEY A PRIMARY KEY constraint is a unique identifier of a row within a table. Every table should have a primary key constraint to uniquely identify each row and only one primary key constraint can be created for each table. Primary key should not contain duplicate values. A primary key column cannot contain NULL values. Note: In Oracle, a primary key cannot contain more than 32 columns.

ii.

FOREIGN KEY A FOREIGN KEY is used to join two tables. A foreign key in one table points to a primary key in another table. Foreign keys prevent actions that would leave rows with foreign key values when there are no primary keys with that value.

iii.

UNIQUE KEY A UNIQUE constraint enforces the uniqueness of the values in a set of columns, so no duplicate values are entered. The UNIQUE and PRIMARY KEY constraints both provide unique vales for a column or set of columns. A PRIMARY KEY constraint automatically has a UNIQUE constraint defined. Note that you can have many UNIQUE constraints per table, but only one PRIMARY KEY constraint per table.

iv. v.

CHECK Check constraint rule is used to limit the value range to a column NOT NULL A NOT NULL constraint rule is used to ensure that column will not accept the null values.

7) VIEW TABLE A view is a logical based table which contains the data selected from one or more table or view. It is used to restrict the data from a user to provide security. It is used to provide security to the data as well as complexity of data can be hidden. Changes made using DML command operations in view affect the original table

8) DISTINCT In a table, some of the columns may contain same or duplicate values. The DISTINCT keyword can be used to return only distinct (different) values.

9) ORDER BY Order by clause is used to obtain the result in order by a specified column. By default the order is in ascending order. DESC is the keyword to sort the order in reverse order. 10) COUNT FUNCTION Count function is used to count the number of values in specified column or row or In entire table. Note that if a null value is present in a table then it cannot be counted

Anda mungkin juga menyukai