Sequence :
SQL> Create or replace sequence no_seq start with 1 increment by 1 ;
To use this sequence in insert statement :
Insert into emp values (no_seq.next,'john',100);
Index :
Types :- To generate sequences numbers to a column sequence is used.
- Can be used for any column of table.
- Column data type should be number.
SQL> Create or replace sequence no_seq start with 1 increment by 1 ;
To use this sequence in insert statement :
Insert into emp values (no_seq.next,'john',100);
Index :
- To speed up sql statement execution on a table .
- it points directly to the location of the rows containing the values.
- Unique
- Non-Unique
- B-Tree
- Composite
- Function based
- Cluster
- It guarantee that no two rows of a table have duplicate values in the columns that define the index.
- Automatically created when primary key or unique key constraint is created.
SQL> create unique index stude_idx on student(sno);
Non-Unique :
- it doesn't impose the above restrictions on the column values.
SQL> create index stude_idx on student(sno);
B-Tree :
- Default type of index in oracle.
- Created when column having more distinct or unique values . eg. student no , employee no etc.
Bitmap Index :
- Created when the columns have low cardinality values or distinct values.
- gender ,country etc.
Composite Index :
- also called concatenated index.
- Created on multiple columns
create bitmap index student_idx on student(sno,sname);
Function based Index :
- When we use any functions within the where clause we define function based index.
0 comments:
Post a Comment