Hi Everyone,
Here are the basic Oracle queries.
Thanks for reading my Blog !
Here are the basic Oracle queries.
Simple
select statement
SELECT col1 [,col2,
col3, ...] FROM tab1 [tab2, tab3, ...] WHERE
condition1 [, condition2, condition3, ...]
selects all the record
SELECT * FROM emp;
selects records where empname is equal to shibin
SELECT * FROM emp WHERE empname='shibin';
selects the fields empname, salary from emp table
SELECT empname,
salary FROM emp;
DISTINCT
in SELECT Statement
SELECT DISTINCT empname FROM emp;
SELECT
in Multiple Tables
SELECT e.empid,
e.empname, d.deptname, e.salary FROM emp e, dept d WHERE e.deptid=d.deptid;
IN
clause in select
SELECT * FROM emp WHERE empname IN ('shibin','shine');
BETWEEN
clause in slect
SELECT * FROM emp WHERE salary BETWEEN 500 AND
2500;
LIKE
clause in select
SELECT * FROM emp WHERE empname LIKE 's%';
ORDER
BY caluse in select
SELECT * FROM emp ORDER BY empname DESC
HAVING
clause in select
SELECT deptid,
SUM(salary)
FROM emp GROUP BY deptid HAVING SUM(salary)>1000
Thanks for reading my Blog !
0 comments:
Post a Comment