To create table
Create table
To insert to table
Insert into
To view the all the data table
Select * from
To view some column
Select
To update data in the table
Update
To delete from table
Delete from
To drop the table;
Drop table
To set primary key
When you create the table
Create table
After creating the table
Alter table
To set foreign key
When creating the table
Create table
After creating the table
Alter table
References
To set the check constraint
When creating the table
1-column type
Create table
check(column1 operator rule));
2-table type
Create table
after the table created
alter table
to set not null
when creating the table
create table
to set unique key
when create the table
create table
after creating the table
alter table
to use joins
1-inner join
select column1-table1,column1-table2 from
where
2-right join
select column1-table1,column1-table2 from
where
3-left join
select column1-table1,column1-table2 from
where
3-self join
select a.column1,b.column1 from
a.column1 > b.column1 order by
to view the sum
select sum(column-name) from
to view the average
select avg(column-name) from
to view max
select max(column-name) from
to view min
select min(column-name> from
to view some character from the column
select substr(column-name,1,3) from
to view in upper case
select upper(column name) from
to view in lower case
select lower(column-name) from
to view the first latter in capital
select initcap(column-name) from
to remove spaces from left side of the column
select * from
to remove spaces from right sode of the column
select * from
to view the system date
select sysdate from dual;
to view the structure of the table
desc
to add new column to the table
alter table
to modify the column in table
alter table
to view data using in operator
select
to view data using not in operator
select
to create sequence
create sequence
increment by
start with
maxvalue
/
you can use cycle after the maxvalue so when its finished it can repeat
to modify the sequence
alter sequence
increment by
start with
maxvalue
/
to use sequence
insert into
to create synonyms
create synonym
to drop the synonym
drop synonym
to drop the constrain
alter table
to drop the primary key
alter table
but if the primary key was referenced to a foreign key you cant drop
to make the constraint enabled or disabled
alter table
alter table
to put the up title on the report
ttitle ‘the data you want to write’
to set it off
ttitle off
to put the bottom title
btitle ‘the data you want to write’
to set it of
btitle off
to let the sql print report
set serveroutput on
to save to the tables
set autocommit on
to set the line size for the table
set linesize value
to set how many rows to be displayed
set pagesize value
to set the number of the column width
set numwidth value
to set the format of the column
column
to set break between the rows
break on
to set for average for report
before to set average it must have break on
the on-value must match the compute on value
break on
compute avg of
to set for sum for report
before to set sum it must have break on
break on
compute sum of
1 comment:
Post a Comment