Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. Show all posts

Monday, February 7, 2011

About SQL and different commands

Introduction to SQL
  • SQL is referred as Structured query language, is database computer language required for managing the data relational data base management system.It acts as Interface for database only,universal interface.
  • SQL is Non-Procedural language and it is 4th generation language.
  • Procedural means execution from top to bottom and it is 3rd generation language.
 Different types of commands:-
  1. Data definition language(DDL)
  2. Data manipulation language(DML)
  3. Transaction control language (TCL)
  4. Data control language(DCL)
  5. System control language(SCL)
  6. Session control language(SCL)
  7. Data Query/Retrieval language
SQL commands ready to work with any platform.It is independent of O/S.It is permission oriented language or it requires privileges.It is exclusively used for DB because it a DB language.
DDL consists of :
  1. Create
  2. Alter
  3. Drop
DML consists of :
  1. Select
  2. Update
  3. Delete
  4. Insert
TCL consists of :
  1. Savepoint
  2. Commit
  3. Rollback
DCL consists of:
  1. Grant 
  2. Revoke
CREATE:
Create command is used to create the DB objects like table,view, synonym, sequence, user, index, cluster, tablespace, segment, database, DBlink, proceduire, Function, Package, Trigger, Role, Directory type...
Syntax
CREATE TABLE TABLENAME
( datatype(width), datatype(width));Ex:  create table student(RollNum number(3), Name varchar2(10)); 
 
Various datatypes  
 
  • Char(size): To store fixed length char strings.Max upto 2000 bytes.By default 1 Byte.  
  • Varchar(size):To store variable length.Max 4000 Bytes. Difference between varchar and char is that when we use char and assign the size all the placed are reserved for that column and where as varchar releases the memory when they are not used. 
  • LONG: Data upto 2 GB can be stored. 
  • RAW:To store binary data like signature,Thumb,impressions,photographs. 
  • Long Raw: To store binary data upto 2GB size No default. 
  • LOB: large objects  
  • CLOB: char large objects  
  • BLOB:Binary large objects.
  • Bfile:Binary file 
  • Number(P,S):where P is primary, S is secondary(where P is left size of precision,S is right side precision) Ex:Salary number(6,2).   Date: DD-MM-YY
will be contd....

Wednesday, February 2, 2011

Introduction to Oracle

Oracle 11G

The Oracle Database (commonly referred to as Oracle RDBMS or simply as Oracle) is an object-relational database management system (ORDBMS) produced and marketed by Oracle Corporation.

Larry Ellison and his friends and former co-workers Bob Miner and Ed Oates started the consultancy Software Development Laboratories (SDL) in 1977. SDL developed the original version of the Oracle software. The name Oracle comes from the code-name of a CIA-funded project Ellison had worked on while previously employed by Ampex.

General View of Oracle

Introduction to DBMS::
DBMS-Collection of Integrated Interrelated data i.e.in DBMS the data which we are going to store is interrelated.unlike general notepad were data is not related.

Database records the data only once but reads it many times.

Oracle stores the data in the form of records.Each Record maintain 1000 fields.
1 Field can accommodate up to 4 GB


Entity
Entity can be anything in real world which has some properties through which it can identified uniquely form others.
Ex- Let as take student as an entity and Roll Number,Section,Class can be treated as his properties.this properties are called as attributes in database terminology.

Database is used to maintain entity and in RDBMS it is in Tabular form.
Table is a 2 dimensional here.Table consists of rows and colums.
In oracle we can have maximum of 1000 columns and there is no limit of rows.