Forums.Sureshkumar.net : A Perfect Place to Share Knowledge         Blogs     Games    Magazines

"Sharing knowledge does not lessen your store, often it gets you more. Sharing plays a key role in relationships and bonding, happens in small steps and is assisted through community membership."

Go Back   SURESHKUMAR.NET FORUMS > Blogs
Register FAQ Members List Calendar Games Blogs Search Today's Posts Mark Forums Read

   

In this blog I will post all FAQs, code snippets, real time problems and solutions and any other links which I feel every one needs and can take advantage of.
Old

SQL to select middle record of a table

Posted 13-11-07 at 11:48 PM by sk_kireeti
A decision has to taken carefully before we implement a solution for the two possibilities -
  1. When we have odd total number of rows
  2. When we have even total number of rows
My SQL will work differently in each case.

In first case (odd number of total rows), this SQL query will return middle record with out any conflict. Eg., If we have 9 records, this will display 5th record from table.

In second case (even number of total rows), this SQL query will return middle two...
sk_kireeti's Avatar
Super Moderator
Posted in Oracle SQL
Comments 1 sk_kireeti is offline
Old

Query to find first and last records of a table

Posted 13-11-07 at 11:34 PM by sk_kireeti
select * from
(select rownum sno, empno,ename from emp)
where
sno =1
or sno=(select count(*) from emp);
sk_kireeti's Avatar
Super Moderator
Posted in Oracle SQL
Comments 0 sk_kireeti is offline

All times are GMT +6.5. The time now is 07:22 AM.





Search Engine Optimization by vBSEO 3.1.0