General Query:
select * from T;
To remove duplicate values:
Select distinct f1,f2 from T;
Between usage:
SELECT * FROM t where F1 not/between 1and 2;
Like usage:
SELECT * FROM t where F1 not/like ' _mdb% ';
In usage:
SELECT * FROM t where F1 not/in (n1,n2.);
Show the first 5 lines:
SELECT * FROM t where rownum<=5;
Sequential/reverse order:
SELECT * FROM-t order by F1,F2 Asc/desc;
Sum by field:
Select SUM (F2) from T1 GROUP by F1;
When federating multiple tables, use having to replace where:
Having AVG (F1) >50;
Combine two columns to display:
Select F1| | ': ' | | F2 as F12 from T;
To back up table data:
CREATE TABLE t2 as select * from T1;
To insert data from another table:
INSERT INTO T2 select * from T2;
To find an average of a column:
Select AVG (F1) from T1;
To find the number of rows:
Select COUNT (*/f1) from T1;
Maximum/Minimum Value:
Select Max/min (F1) from T1;
Floating-point data rounding:
Select Round (f5,2) from T1;
Data entry:
Select *from T1 inner/left/right/full join T2 on T1.F1=T2.F2;
Data Federation (the two table columns need to be the same):
Select F1,f4 FROMT1 Union select f1,f2 from T2;
Data interception:
Select substr (f1,1,3) from T1;
Update T1 set F1=SUBSTR (f2,1,3) | | ' Say ' | | SUBSTR (f3,7);
Common Query operations in Oracle