Oracle is one of the powerful RDBMS product, that provides efficient and effective solutions for major database management.
It is one of many database systems that are used for Client/Server computing.
It allows sharing of data by multiple users or applications (Client/Front end) by allowing them to concurrently access a centrally maintained database server (Server/Back end).
As Oracle 8 is a database server, it offers the capabilities of both relational and object oriented database system. Hence, it is an Object Relational Database Management System (ORDBMS), which provides efficient solutions for major database management.
* querying data, * inserting, updating and deleting data * creating, modifying and deleting database objects * controlling access to the database and database objects * guaranteeing database consistency * monitoring database performance and configuration
Standard SQL statements can be subdivided into 4 distinct groups
Group Statements Description
DDL - D ata D efinition L anguage
[Create, Alter, Drop] - Used to manipulate database structures and definitions.
DML - D ata M anipulation L anguage
[Insert, Update, Delete] - Used to change database data.
DQL - D ata Q uery L anguage
[Select] - Used to get data from the database and impose ordering upon it.
TCL - T ransaction C ontrol L anguage.
[commit, Rollback, Savepoint] -
DCL - Data Control Language.
[Revoke, Grant] - Used to give and take access rights to database objects.
Alter Table Emp Modify (Empno Number(7), Ename Varchar2(25), Job Varchar2(15));
Increasing or decreasing width of the data type depends on the new size specified (inside Parenthesis) in the ALTER TABLE command i.e. if you increase the size then the size of the data type will be increased and vice versa.
To Change the data type or to decrease the width of the data type for a column, that particular column should be empty (NULL) for all the records.
SQL provides the CHECK constraint, which allows the user to define the range of values to the column(s). The following example illustrates the definition of the check constraint to SAL column with user-defined name ( column level ).
Create table Employee (
Empno number(4), Ename varchar2(20),
Design varchar2(15), sal number(5) Constraint Emp_sal_ck CHECK (sal > 500 and sal < 10001), Deptno number(2)
Check constraint to sal column with user-defined name at table level
Create table Employee (Empno number(4), Ename varchar2(20), Design varchar2(15), Sal number(5), Deptno number(2), Constraint Emp_sal_ck CHECK (sal > 500 and sal < 10001));
In the above two examples, the SAL column will accept values between 501 and 10000;
This constraint will expect some values to be entered in the specified columns. Any attempt to put NULL value in that column will be rejected. Columns without NOT NULL constraint will allow NULL values.
The definition of NOT NULL constraints to ENAME column at Column level.
Create Table Employee (Empno Number(4), Ename Varchar2(20) Constraint Emp_name_nn NOT NULL , Design Varchar2(20), Sal Number(5));
NOT NULL constraints cannot be specified in the table level.
While inserting a row into a table without having value for a column, SQL will insert a default value to the specified column.
Default value assignments are defined in the CREATE TABLE command in the same way as column constraints. Default is actually not a constraint , but merely to specify what happens if the user does not enter values for the given columns?
The following example illustrates the definition of the default constraints to MSTAT column ( Column level )