Oracle

From Andreida
Revision as of 11:55, 16 February 2016 by Andreas (talk | contribs) (Created page with "=== Index === Show: <pre> select * from dba_ind_columns where lower(table_name) = '<table>'; -- you only change <table> </pre> Create: <pre> create index <indexName> on <tab...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Index

Show:

 select * from dba_ind_columns where lower(table_name) = '<table>'; -- you only change <table>

Create:

create index <indexName> on <table> (<column1>, <column2>, ...);

Drop with either

drop <indexName>;

or

alter table <table> drop constraint <indexName>;

Select

Samples:

 select * from <table> sample(0.1);

Select <n> rows:

select <field1>, <field2> from 
(select <field1>, <field2>, row_number() over (order by <field2>) r from items) 
where r between 1 and <n>;


Links