1. Basic SQL Functions
Data Definition Language:
Create
Alter
Drop
Data Manipulation Language:
Insert
Delete
Update
Always COMMIT for data manipulation languages
Delete:
Deletes the data from table, but the memory for the table still remains and the structure of the
table remains and the data can be retrieved by the DBA. Where condition can be used.
Truncate:
Truncates the data from table and also removes the memory for the table from server ,the
structure of the table remains and the data truncated cannot be retrieved again. Where
condition cannot be used.
Drop:
Drops the table, its data, its memory and the structure of the table completely.
V$ parameter:
For Utl directory:
Select * from v$parameter where name like %utl%
For Trace file directory
Select * from v$parameter where name like ‘%user%dump%’
2. Functions to be known mandatory
= (Equal To):
This function is used as equal to ,i.e inorder to match the records in the table as a direct
comparision:
Eg: Select * from
Employees
Where name =’Shravan’
!= (Not Equal to) :
This function is used as not equal to, inorder to exclude the records
<>
In
Not in
Like
Not like
Union
Union all
Minus
Distinct
Sum
Avg
Max
Min
Count
Group by
Having
4. ABS
Translate
Joins
RegExp_Replace
Create Statement:
Create can be used to create :
Table
Index
Sequence
View
PL/SQL (Procedure,package,function,Trigger)
Sequence creation:
Create Sequence<seq name>
Maxvalue (Optional)
Minvalue (Optional)
Start with 1
Increment by 1
Cache (Optional)
Nextval ->next value Currval-current value
Select s1.nextval from dual
Select s1.currval from dual
To alter sequence:
Alter sequence s1
Increment by -3
Index:
Indexes are of different types, mostly used are
5. UNIQUE
BINARY
HASH
FUNCTION
Create Index <index_name> on table_name(column name)
Views:
Views are nothing but collection of tables, once the tables in the view are updated the view
automatically takes the data from updated tables, by using the select statement every time it
has to join the tables it takes time ,this is avoided using the views.
Create or Replace view as
Select * from table1,table2,table3 where table.col1=table2.col3