Search...

Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Thursday, October 15, 2015

What is SQL? Why we use SQL? SQL Process?

SQL

SQL is Structured Query Language, which is a computer language for storing, manipulating and retrieving data stored in relational database.

Saturday, April 4, 2015

SQL Queries


1.     To fetch ALTERNATE records from a table. (EVEN NUMBERED)
select * from emp where rowid in (select decode(mod(rownum,2),0,rowid, null) from emp);


2.     To select ALTERNATE records from a table. (ODD NUMBERED)
select * from emp where rowid in (select decode(mod(rownum,2),0,null ,rowid) from emp);


3.     Find the 3rd MAX salary in the emp table.
select distinct sal from emp e1 where 3 = (select count(distinct sal) from emp e2 where e1.sal <= e2.sal);


4.     Find the 3rd MIN salary in the emp table.
select distinct sal from emp e1 where 3 = (select count(distinct sal) from emp e2where e1.sal >= e2.sal);


5.     Select FIRST n records from a table.
select * from emp where rownum<= &n;

Sunday, December 21, 2014

Free Download SQL The Complete Reference 3rd Edition

Title : SQL The Complete Reference

Author(s) : James R Groff, Paul N. Weinberg, Andy Oppel

Edition : 3rd Edition