create identified by ;
//it will create a new user in SQL
Grant connect,resource to ;
//this will give permission to access our account by our user name
DDL :-
create ([[column_name data_type],...]);
//Here we can give any number of columns;
alter table
add([[column_name data_type],...]);
//if we want to add new column in our table
alter table
modify([[column_name modified_column_name],...]);
//if we want to modify a column name
truncate table ;
//it will delete all rows from our table.
drop table ;
//it will delete all rows alongwith columns i.e. schema(or structure) of our table
DML :-
select from ;
//it will display all data from specified column names.
//if we want all columns we include * at the column name
insert into values([[column_name value]...]);
or
insert into values();
delete from [from where ];
//if we doesn't specify any condition it will acts like truncate command i.e. it will delete all rows.
//if we specify a condition it will delete particular columns which satisfied by conditions
Constraints :-
we can assign some constraint at the time of creation or after creation
create table ([column_name data_type not null],...]);
//this will create a column with specified column with not null property i.e. it doesn't take any null values
alter table modify not null;
//this will modifies a already created column to not null property.
create table ([[column_name data_type constraint check ]...]);
//this will create column(s) with specified constraint
Function:-
create or replace function[schema]
([[ in ]...]) return IS
variable declaration;
constant declaration;
BEGIN
[EXCEPTION]
END; /
//this is for creating function in PL/SQL
drop function ;
//this will delete specified function.
Trigger :-
CREATE OR REPLACE TRIGGER
[{before,after}]{DELETE,INSERT,UPDATE [of columns...]} ON
[REFERENCING {OLD AS OLD,NEW AS NEW}]
[FOR EACH ROW [when ]]
DECLARE
BEGIN
[EXCEPTION]
END;
Cursor :-
Cursor Declaration:
CURSOR IS ;
/* Here most time SQL command is select */
Opening a cursor:
OPEN ;
Fetching a record from the cursor:
FETCH into ;
Closing a cursor:
CLOSE ;
Parameterized Cursor:-
CURSOR () is ;
Open cursor_name([value/variable/expression]);
For Loop :-
for memvar in
Loop
[...
...
]
ENd LOOP;