Nethence Newdoc Olddoc Lab Your IP BBDock  


Warning: those guides are mostly obsolete, please have a look at the new documentation.

UnixWindowsOracleObsoleteHardwareDIYMechanicsScriptsConfigs

Oracle SQL Basics
 
 
Create table
create table table1 (
col1 varchar2(200),
col2 varchar2(200),
col3 varchar2(200)
);
create table table2 (
col1 varchar2(200),
col2 varchar2(200)
);
 
 
Insert into
--truncate table table1;
insert into table1 values ('lala', 'lili', 'lolo');
insert into table1 values ('lala2', 'lili', 'lolo2');
insert into table1 values ('lala3', 'lili', 'lolo3');
insert into table1 values ('lala4', 'lili', 'lolo4');
insert into table1 values ('lala5', 'lili5', 'lolo5');
  --truncate table table2;
insert into table2 values ('lala', 'lili');
insert into table2 values ('lala2', 'lili2');
insert into table2 values ('lala2', 'lili3');
 
 
AND / OR
select col1, col2, col3
from table1
where col2='lili'
and (col3='lolo'
or col3='lolo2')
order by col1;
 
Where in / distinct
select col1, col2, col3
from table1
where col1 in (
select distinct col1
from table2
);
 
 
References
(FR) Manipulation de donnée : http://basiscomponent.com/Oratricks.aspx
 

(obsolete, see the new doc)