1. Finds the two highest salaries from table "emp".
Code:
select a.empno,a.sal
from emp a
where 2>
(
select count(*)
from emp
where sal>a.sal
);
2. Finds the two lowest salaries from table "emp".
Code:
select a.empno,a.sal
from emp a
where 2>
(
select count(*)
from emp
where sal<a.sal
)
Welcome to the GEEK world, best place where you find topic about latest cutting edge technology on website and mobile. Learn and grow your knowledge with the information and tutorials about Website designing, CSS tutorials, Java Script tutorials, Ruby tutorials, ROR tutorials, HTML tutorials, HTML5 , JQuery, Javascript tutorials, Photoshop tutorials, Flash, games tutorials, Cheat sheets, Design tools, Action Scripts as well as MySql, Oracle and many more in a easy way to use and understand.
Monday, May 14, 2012
Oracle DBA Script : Monitor File I/O
This script takes a snapshot of v$filestats at the current time and saves it. It then waits 10 seconds and takes another snapshot and reports on the delta.
Code:
col name for a50
set linesize 132
set pages 666
-- drop temporary table
drop table jh$filestats;
create table jh$filestats as
select file#, PHYBLKRD, PHYBLKWRT
from v$filestat;
prompt Waiting......
exec dbms_lock.sleep(10);
prompt NOTE: Only the top 10 files...
select * from (
select df.name, fs.phyblkrd - t.phyblkrd "Reads",fs.PHYBLKWRT - t.PHYBLKWRT "Writes",(fs.PHYBLKRD+fs.PHYBLKWRT) - (t.PHYBLKRD+t.PHYBLKWRT) "Total IO"
from v$filestat fs, v$datafile df, jh$filestats t
where df.file# = fs.file# and t.file# = fs.file#
and (fs.PHYBLKRD+fs.PHYBLKWRT) - (t.PHYBLKRD+t.PHYBLKWRT) > 0
order by "Total IO" desc )
where rownum <= 10
/
Code:
col name for a50
set linesize 132
set pages 666
-- drop temporary table
drop table jh$filestats;
create table jh$filestats as
select file#, PHYBLKRD, PHYBLKWRT
from v$filestat;
prompt Waiting......
exec dbms_lock.sleep(10);
prompt NOTE: Only the top 10 files...
select * from (
select df.name, fs.phyblkrd - t.phyblkrd "Reads",fs.PHYBLKWRT - t.PHYBLKWRT "Writes",(fs.PHYBLKRD+fs.PHYBLKWRT) - (t.PHYBLKRD+t.PHYBLKWRT) "Total IO"
from v$filestat fs, v$datafile df, jh$filestats t
where df.file# = fs.file# and t.file# = fs.file#
and (fs.PHYBLKRD+fs.PHYBLKWRT) - (t.PHYBLKRD+t.PHYBLKWRT) > 0
order by "Total IO" desc )
where rownum <= 10
/
Oracle DBA Script : Show View Source
Code:
SET HEADING OFF
SET ECHO OFF
SET FEEDBACK OFF
SET PAGESIZE 0
set numwidth 10
SELECT uv.view_name SORT1, 0 SORT2, 0 SORT3,
0 SORT4,
'create or replace view '||uv.view_name ||' ('
from dba_views uv
WHERE uv.owner = upper('&2')
and uv.view_name = upper('&1')
union all
SELECT utc.view_name SORT1, utc.column_id
SORT2, 0 SORT3, 0 SORT4,utc.column_name
from dba_tab_columns
WHERE utc.owner = upper('&2')
and utc.table_name = upper('&1')
and utc.column_id = 1
union all
SELECT utc.view_name SORT1, utc.column_id
SORT2, 0 SORT3, 0 SORT4,
' , '||utc.column_name
from dba_tab_columns
WHERE utc.owner = upper('&2')
and utc.table_name = upper('&1')
and utc.column_id <> 1
SELECT uv.view_name SORT1,999 SORT2,0
SORT3,0 SORT4,' )'
from dba_views uv
WHERE uv.owner = upper('&2')
and uv.view_name = upper('&1')
ORDER BY 1, 2, 3, 4;
SELECT uv.text
from dba_views uv
WHERE uv.owner = upper('&2')
and uv.view_name = upper('&1');
SELECT uv.view_name SORT1,999 SORT2,0
SORT3,0 SORT4,' ;'
from dba_views uv
WHERE uv.owner = upper('&2')
and uv.view_name = upper('&1');
SET HEADING OFF
SET ECHO OFF
SET FEEDBACK OFF
SET PAGESIZE 0
set numwidth 10
SELECT uv.view_name SORT1, 0 SORT2, 0 SORT3,
0 SORT4,
'create or replace view '||uv.view_name ||' ('
from dba_views uv
WHERE uv.owner = upper('&2')
and uv.view_name = upper('&1')
union all
SELECT utc.view_name SORT1, utc.column_id
SORT2, 0 SORT3, 0 SORT4,utc.column_name
from dba_tab_columns
WHERE utc.owner = upper('&2')
and utc.table_name = upper('&1')
and utc.column_id = 1
union all
SELECT utc.view_name SORT1, utc.column_id
SORT2, 0 SORT3, 0 SORT4,
' , '||utc.column_name
from dba_tab_columns
WHERE utc.owner = upper('&2')
and utc.table_name = upper('&1')
and utc.column_id <> 1
SELECT uv.view_name SORT1,999 SORT2,0
SORT3,0 SORT4,' )'
from dba_views uv
WHERE uv.owner = upper('&2')
and uv.view_name = upper('&1')
ORDER BY 1, 2, 3, 4;
SELECT uv.text
from dba_views uv
WHERE uv.owner = upper('&2')
and uv.view_name = upper('&1');
SELECT uv.view_name SORT1,999 SORT2,0
SORT3,0 SORT4,' ;'
from dba_views uv
WHERE uv.owner = upper('&2')
and uv.view_name = upper('&1');
Oracle DBA Script : Show Package Source
This script Extract package and package body source from the database.
Code:
COL SORT1 NOPRINT
COL SORT2 NOPRINT
COL SORT3 NOPRINT
COL SORT4 NOPRINT
BREAK ON SORT1 SKIP 1
set linesize 120
SET HEADING OFF
SET ECHO OFF
SET FEEDBACK OFF
SET PAGESIZE 0
SPOOL bldpack.sql
select 'set echo on ' from dual;
select 'spool bldpack.lst' from dual;
select 'Remark Build package definitions' from dual;
SELECT NAME SORT1, LINE SORT2,
'Create or Replace ' || TEXT
FROM USER_SOURCE
WHERE TYPE = 'PACKAGE' AND LINE = 1
UNION
SELECT NAME SORT1, LINE SORT2,TEXT
FROM USER_SOURCE
WHERE TYPE = 'PACKAGE' AND LINE > 1
UNION
SELECT NAME SORT1, 999999 SORT2, '/'
FROM USER_SOURCE
WHERE TYPE = 'PACKAGE' AND LINE =1
ORDER BY 1,2;
Code:
COL SORT1 NOPRINT
COL SORT2 NOPRINT
COL SORT3 NOPRINT
COL SORT4 NOPRINT
BREAK ON SORT1 SKIP 1
set linesize 120
SET HEADING OFF
SET ECHO OFF
SET FEEDBACK OFF
SET PAGESIZE 0
SPOOL bldpack.sql
select 'set echo on ' from dual;
select 'spool bldpack.lst' from dual;
select 'Remark Build package definitions' from dual;
SELECT NAME SORT1, LINE SORT2,
'Create or Replace ' || TEXT
FROM USER_SOURCE
WHERE TYPE = 'PACKAGE' AND LINE = 1
UNION
SELECT NAME SORT1, LINE SORT2,TEXT
FROM USER_SOURCE
WHERE TYPE = 'PACKAGE' AND LINE > 1
UNION
SELECT NAME SORT1, 999999 SORT2, '/'
FROM USER_SOURCE
WHERE TYPE = 'PACKAGE' AND LINE =1
ORDER BY 1,2;
Oracle DBA Script : Active Transactions in Rollback Segments
column rr heading 'RB Segment' format a18
column us heading 'Username' format a15
column os heading 'OS User' format a10
column te heading 'Terminal' format a10
SELECT r.name rr,
nvl(s.username,'no transaction') us,
s.osuser os,
s.terminal te
FROM
v$lock l,
v$session s,
v$rollname r
WHERE
l.sid = s.sid(+) AND
trunc(l.id1/65536) = r.usn AND
l.type = 'TX' AND
l.lmode = 6
ORDER BY r.name
/
column us heading 'Username' format a15
column os heading 'OS User' format a10
column te heading 'Terminal' format a10
SELECT r.name rr,
nvl(s.username,'no transaction') us,
s.osuser os,
s.terminal te
FROM
v$lock l,
v$session s,
v$rollname r
WHERE
l.sid = s.sid(+) AND
trunc(l.id1/65536) = r.usn AND
l.type = 'TX' AND
l.lmode = 6
ORDER BY r.name
/
Monday, May 7, 2012
CarePointz app for iPhone / iPad
Health5C proud to announce our new app "CarePointz" for iPhone / iPad users.
Do you have a jet set lifestyle or are you a frequent traveler!? This application is for you. You never sure what you are searching in a new place? Carepointz, which can help you pinpoint your nearest medical/ health related facility based on your choice. Best thing of this app is that it discovers the current location of user and suggests the best nearby medical/health facility. Health5C is improving this app day by day and may be within two or three weeks you will get new features with new version.
The tool finds places either through your internet connection Wi-Fi (if present) or through your Mobile Service Provider. CarePointz provides 35 different criteria's for search. You can see your current location along with normal or satellite or hybrid map view. Search results are also available offline to ensure you do not miss your findings, in case, you experience any network issue.
Friday, May 4, 2012
How to : jQuery UI Autocomplete - Combobox ( dropdown )
Convert your <select> into beautiful jQuery UI Combobox. Its been fun with jQuery and UI is really cool. This is what i got when finished. ( final output )
You can customize the widget as you want. for this you need jQuery UI , I downloaded my own jQueryUI Theme using Theamroller. You can download default theme or customize it as per your project need, just download it from here. To do this cool widget i follow following steps.
Step 1:Add Javascripts and CSS to your page
Here i have downloaded 1.8.20 version and using same for this tutorial. For this widget i added few scripts and css style in header section of HTML page.
Tuesday, April 17, 2012
Free must have Medicine Reminder App for iPhone
Do you forget taking medications for yourself or reminding your family?
Now we Health5C have solutions for this.
Last night suddenly i got a message on my phone saying congratulation our iPhone application in now in app store now. Our iPhone app is in appstore now and there's more to come to make ur lives easier and healthier!! Medi Reminder allows you to schedule your intake of medication as prescribed by your Physician.
YES Medicine Reminder app by Health5C is 100% Free!!
"Medi Reminder" App allows you to manage not only your medications but also your family schedules with easy-to-use features:- Set medication reminders for multiple people (including your pets!).
- Maintain a Medi-Kit - Medi Kit allows you to keep a list of all medicines with their stock. Take a snapshot of the medications, for easy identification.
- You can manage a profile for each individual.
- Automatically track stock, each time you take a medication.
- Snooze your reminder if you are busy, to take your medications later.
So, this time we won't let you miss your medication with Medi Reminder!
Monday, April 16, 2012
Photoshop CS6 beta Ready to download
Adobe Photoshop "World's best digital image editing software" beta CS6 is available for download now. It has new look and some really effective and magical tools. Adobe Photoshop CS6 beta is capable of 3D image editing and quantitative image analysis capabilities but these features are available in shipping version of Photoshop CS6 extended. You'll find lots of new ways to work faster and with greater creative freedom and precision when you dive into Photoshop CS6 beta.
You can free download adobe Photoshop CS6 beta by following link given below
Link: http://labs.adobe.com
Here below 3 videos displays capabilities of new Photoshop CS6 beta.
Thursday, April 5, 2012
Why inkscape is not running fine with mac snow leopard?
Inkscape is very powerful and can do some amazing things. It's got too many features in some ways for my needs, I like it very much. This is my one of the favorite vector editing software.
I downloaded inkscape for snow leopard. When I run the app I get a menu that has nothing but one item: Inkscape, and it has no other options. No screen opens up, no other menu items pertaining to drawing appear. If I click the app where it sits on the app bar running along the bottom of my screen, everything on the bar.
I googled and after few research i found it required xQuartz to be installed first. i downloaded the latest xquartz from macosforge.org. The XQuartz project is an open-source X Window System that runs on OS X. Together with supporting libraries and applications.
I started xquartz it appeared on the dock and opened a little terminal window. Then I started inkscape.app. This time it showed the message to wait a few minutes while it did whatever. Then the Editor appeared. This time Inkscape worked fine and i'm doing some good svg kind of stuff in it.....
More info : Inkscape , macosforge.org and yeh google.
Subscribe to:
Posts (Atom)