SQL query to compare yearly sales
How do I compare sales in 2005 versus sales in 2004?
sales calendar year go from October 1 through Sep 30 (sales 2004 is from Oct 1, 2003 thro Sep 2004)
Have an orders table as:
(dist_id number,
prod_type varchar2(1),
prod_line varchar2(1),
quantity number,
sales_date date)
I could have easily done the following SQL if sales calendar year was from Jan 1 thro Dec 30, but this will not work since sales calendar year is from Oct 1 thro Sep 30.--
"select dist_id, prod_type, prod_line, sum(decode(to_char(sales_date,'yyyy'),'2004',quantity,0)) Sales2004, sum(decode(to_char(sales_date,'yyyy'),'2005',tot,0)) Sales2005
from orders
group by dist_id, prod_type, prod_line"
Please help by email: [email protected] or reply to this message
select dist_id, prod_type, prod_line,
sum (case when sales_date between to_date ('oct-01-2003', 'mon-dd-yyyy')
and to_date ('sep-30-2004', 'mon-dd-yyyy')
then quantity
else 0
end) Sales2004,
sum (case when sales_date between to_date ('oct-01-2004', 'mon-dd-yyyy')
and to_date ('sep-30-2005', 'mon-dd-yyyy')
then quantity
else 0
end) Sales2005
from orders
group by dist_id, prod_type, prod_line;
Similar Messages
-
Hi guys,
I need your help to solve these queries. Kindly help.
1)Given a orders table something like the below that has data for last 2 years:
Order Day Prod_Id Customer_ID Qty_Sold
1/5/2010 P1 C1 10
10/5/2010 P2 C2 30
1/4/2010 P2 C1 20
10/4/2010 P1 C2 40
1/3/2010 P2 C1 30
10/3/2010 P1 C2 20
a) Write a Sql to get YoY comparison of Quantity Sold this year and last year. I.e For every product have two columns to have Thisyear_Sold_Qty and Last_Year_Sold_Qty. Don’t use any function, please write the actual SQL.
b) Write a Sql to get Top 10 Prod_ids by Quantity_Sold. The output should include two columns Product_id and Total_Quantity_Sold. Don’t use any functions.
c) Write a SQL to get list of all Customers who have an order in the month of April 2010, their corresponding 2009 Total quantity_Sold. For instance C1 placed 10 orders in the month of 2010, had a total of 200 quantity_sold entire last year.
d) Write a Sql to get list of Product_ids that had more than 100 customers buying it in April 2010 that was also bought by more than 100 customers in April 2009.
2) An online retail store has 4 different devices available to buy. Customers can buy 1 or all of the devices. Using the device they download music into the devices. Design a data model and write a report like the below:
Transaction Day Total Music Downloaded Music downloaded from D1 Music downloaded from D2 Music downloaded from D3 Music downloaded from D4
3) Assume you have a 2 years (Jan 2009 – Jan 2011) retention aggregate table that is partitioned by Month. If a month’s data (say Oct 2009) is corrupted, how will you refresh the table with the correct Oct 2009 data (assume you can generate corrected Oct 2009 data).
Thanks.Capture these 2 years by having
To_char(date_column) in(‘2011’,’2012’) -
Inserting field text into sql query and comparing values to another table
I have an issue in Visual Web Developer 2010 that I need help with.
The code below is a Gridview Sql query where I'm extracting PART_NUMBER from various tables. I would like to add the table name in a separate field named Table. The end result should appear as follows:
PART_NUMBER Table
010-0075-06 Resistors (or Capacitors, etc.)
Sql query:
SELECT PART_NUMBER
FROM Capacitors
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Connectors
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Diodes
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM ICs
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Inductors
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Misc
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Relays
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Resistors
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Switches
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Transformers
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Transistors
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM [Crystals and Oscillators]
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
ORDER BY PART_NUMBER
I have a separate table (CIS Manufacturer Parts) that contains manufacturer data for the above parts. Multiple manufacturer rows can exist. The connection between tables in the PART_NUMBER field. What I would like to do is make this query
add the table name to the gridview output listing only parts without manufacturer data and the table they can be found in.
This is a lot for a newbie so I will appreciate any help, thanks!Hello Bulldog248,
Thank you for your post.
Your issue is out of support range of VS General Question forum which mainly discusses the usage issue of Visual Studio IDE such as
WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
and Visual Studio Editor.
I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right forum.
Best regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Help with sql query for multiple years
Hello,
I am new to SQL and am trying to perform a query that includes multiple years from 2005 to 2011.
I was trying to enter the following query but received a message that said "Operand should contain 1 column(s)"
SELECT * FROM `auto_2` WHERE `year` LIKE (2005, 2006, 2007, 2008, 2009, 2010, 2011);
What am I doing wrong here? Please advise...
ThanksHi and welcome to the forum,
You cannot use LIKE here, that is for pattern matching.
You need either IN operator, or less known =ANY.
Regards
Peter -
SQL Query find month/year and then calculate difference from start date
Hi All,
Assume I have a table with a column Start_Date. I like to know how we can build a query to so we can find the end of the month date based on the start_ date and then calculate the difference
For example lets say we have a date 12/06/2014 and now based on this we should get the end of the month date which is 30/06/2014. Now we can get the difference which is 18 days.
ThanksHi Jaggy99,
According to your description, you need to get the date difference between a given date and the last day of that month, right?
In this case, please try the query below.
SELECT GETDATE() AS [CURRENTDAY], DATEADD(DAY,-1,DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()) + 1, 0)) AS [LASTDAY],
DATEDIFF(DAY, GETDATE (), DATEADD(DAY,-1,DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()) + 1, 0))) AS [DIFFERENCE]
Regards,
Charlie Liao
TechNet Community Support -
How to show current year and last year sales in a WEBI Report
Hi Guys
How can show current YEar Sales in one column and Last YEar Sales in the other column based on a user prompt for the Current YEar Column.
For Example is user enter 2010 for Year how can i show a Column for Sales-2010 and Sales 2009.
ThanksIf you can modify your Universe add an object named New Object Last Year whose SQL is:( yourTableName.Year + 1)
Then in WebI create two distinct queries in your query Pane. In the first one you could do this:
Query 1:
objects: Year, Sales ... etc.
filters: Year Equal to '1. Prompt Year'
Query 2:
objects: Year, Sales ... etc.
filters: New Object Last Year Equal to '1.Prompt Year'
Then in your report you can drag each object on their respective columns.
If you don't want to use two distinct queries, use one like this:
Query 1:
objects: Year, Sales ... etc.
filters: Year Equal to '1. Prompt Year'
Or
New Object Last Year Equal to '1.Prompt Year'
Edited by: PadawanGirl on Jun 23, 2011 6:28 PM -
Query to compare 2 different tables from 2 different database
Is it possible to write a SQL query to compare 2 Tables from 2 different Oracle Database. Also I need a query to do the same when the database is same.
Thanks in advanceOK, well "compare" can mean one of two things: Compare structure or compare contents. Here is a quick script to compare column structures of two tables on one database:
(select COLUMN_NAME,
DATA_TYPE,
DATA_LENGTH,
DATA_PRECISION,
DATA_SCALE,
NULLABLE
from dba_Tab_columns
where owner=:OWNR1
and table_name = :tablename
minus
select COLUMN_NAME,
DATA_TYPE,
DATA_LENGTH,
DATA_PRECISION,
DATA_SCALE,
NULLABLE
from dba_Tab_columns
where owner=:ownr2
and table_name = :tablename)
union all
(select COLUMN_NAME,
DATA_TYPE,
DATA_LENGTH,
DATA_PRECISION,
DATA_SCALE,
NULLABLE
from dba_Tab_columns
where owner=:ownr2
and table_name = :tablename
minus
select COLUMN_NAME,
DATA_TYPE,
DATA_LENGTH,
DATA_PRECISION,
DATA_SCALE,
NULLABLE
from dba_Tab_columns
where owner=:ownr1
and table_name = :tablename)
If this query returns any rows, then these indicate that there are structural differences between the tables. We do a minus in both directions to ensure that an additional column in either schema will be returned in the query.
If you are going across dblinks to remote tables then you have to amend the "dba_tab_columns" to "sys.dba_tab_columns@yourdblink"
If you also want to compare indexes, triggers, etc then do the same sort of thing for the associated dba_ views for those objects.
And if you want to compare table contents, then often the fastest way is also to check minuses in both directions, if the tables are not too big:
e.g.
(select * from schema1.table@dblink1
minus
select * from schema2.table@dblink2)
union all
(select * from schema2.table@dblink2
minus
select * from schema1.table@dblink1)
local tables, of course, simply omit the "@dblink" issues.
There are tools to help in such things. TOAD, for example, has a pretty good schema comparison tool, and there are plenty of other options out there. But if you need to script this yourself then the logic I've shown is a good starting point.
Cheers,
Mike -
Problem with sql;query tag! Please help ...
Dear all,
I have the following SQL statement submitted by a sql;query tag:
<c:out value='${namestring}'/> // <-- namestring is printed out as ABC-% here.
<sql:query var="resultset">
SELECT sales
FROM SALESTABLE
WHERE name LIKE <c:out value='${namestring}'/> //<-- appearently namestring is not ABC-% anymore!!!
</sql:query>
Everything is fine except the satement "WHERE name LIKE ?". The namestring passed in is supposed to be in the form 'ABC-%'. It indeed prints out as 'ABC-%' before the <sql:query/> tag.
Appearnetly, when it is passed to the statement "WHERE name LIKE ?", it becomes something else because it returns no data.
Note that when I hardcode 'ABC-%' to the WHERE statement, however, I do get a lot of data back.
I also tried to to use <sql:param/> tag to tackle it:
<sql:query var="resultset">
SELECT sales
FROM SALESTABLE
WHERE name LIKE ?
<sql:param value='${namestring}' />
</sql:query>
But still got no data. Is '%" considered as special characters that needs to be treated in a special way? What else do I need to do in order to pass in 'ABC-%' to the statement???
By the way, is there a way to print out the generated SQL statement to see how all the variables are evaluated?
Any help or suggestions will be highly appreciated. Thanks.
Robert.Try to escape the special character '%' using '\%'.
-
hi Experts,
while running SQL Query i am getting an error as
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. for the query
select T1. Dscription,T1.docEntry,T1.Quantity,T1.Price ,
T2.LineText
from OQUT T0 INNER JOIN QUT1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN
QUT10 T2 ON T1.DocEntry = T2.DocEntry where T1.DocEntry='590'
group by T1. Dscription,T1.docEntry,T1.Quantity,T1.Price
,T2.LineText
how to resolve the issueDear Meghanath,
Please use the following query, Hope your purpose will serve.
select T1. Dscription,T1.docEntry,T1.Quantity,T1.Price ,
CAST(T2.LineText as nvarchar (MAX))[LineText]
from OQUT T0 INNER JOIN QUT1 T1 ON T0.DocEntry = T1.DocEntry LEFT OUTER JOIN
QUT10 T2 ON T1.DocEntry = T2.DocEntry --where T1.DocEntry='590'
group by T1. Dscription,T1.docEntry,T1.Quantity,T1.Price
,CAST(T2.LineText as nvarchar (MAX))
Regards,
Amit -
How to compare result from sql query with data writen in html input tag?
how to compare result
from sql query with data
writen in html input tag?
I need to compare
user and password in html form
with all user and password in database
how to do this?
or put the resulr from sql query
in array
please help me?Hi dejani
first get the user name and password enter by the user
using
String sUsername=request.getParameter("name of the textfield");
String sPassword=request.getParameter("name of the textfield");
after executeQuery() statement
int exist=0;
while(rs.next())
String sUserId= rs.getString("username");
String sPass_wd= rs.getString("password");
if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
exist=1;
if(exist==1)
out.println("user exist");
else
out.println("not exist"); -
Hi,
This is my First table: REPORT
with report as (
select 'vendor_1' as vendor,to_date('1/1/2012','DD/MM/YYYY') supply_date, 'customer_1'as customer,'item_1' as item1, 110 as cost from dual union all
select 'vendor_1' as vendor,to_date('1/3/2012','MM/DD/YYYY') supply_date,'customer_1'as customer, 'item_1' as item1,120 as cost from dual union all
select 'vendor_1' as vendor,to_date('1/3/2012','MM/DD/YYYY') supply_date, 'customer_1'as customer, 'item_1' as item1,130 as cost from dual union all
select 'vendor_1' as vendor,to_date('1/4/2012','MM/DD/YYYY') supply_date,'customer_1'as customer, 'item_1' as item1,140 as cost from dual union all
select 'vendor_1' as vendor,to_date('1/10/2012','MM/DD/YYYY') supply_date, 'customer_1'as customer, 'item_1' as item ,200as cost from dual union all
select 'vendor_1' as vendor,to_date('1/23/2012','MM/DD/YYYY') supply_date, 'customer_1'as customer, 'item_1' as item,0 as cost from dual union all
select 'vendor_1' as vendor,to_date('1/6/2012','MM/DD/YYYY') supply_date,'customer_2'as customer, 'item_1' as item1,160 as cost from dual union all
select 'vendor_1' as vendor,to_date('1/7/2012','MM/DD/YYYY') supply_date,'customer_2'as customer, 'item_1' as item1,170 as cost from dual union all
select 'vendor_1' as vendor,to_date('1/8/2012','MM/DD/YYYY') supply_date,'customer_2'as customer, 'item_1' as item1,180 as cost from dual union all
select 'vendor_1' as vendor,to_date('1/9/2012','MM/DD/YYYY') supply_date,'customer_2'as customer,'item_1' as item1,190 as cost from dual union all
select 'vendor_1' as vendor,to_date('1/20/2012','MM/DD/YYYY') supply_date,'customer_2'as customer,'item_1' as item1,300 as cost from dual)
THIS IS MY SECOND TABLE: TEMP_WEEK
WITH temp_week a s(
SELECT '01/01/2012 to 07/01/2012' AS week from dual union all
SELECT '08/01/2012 to 14/01/2012' AS week from dual union all
SELECT '15/01/2012 to 21/01/2012' AS week from dual union all
SELECT '22/01/2012 to 28/01/2012' AS week from dual union all
SELECT '29/01/2012 to 31/01/2012' AS week from dual)
To find weekly sales i have wrote below query:
SELECT week,vendor,customer,SUM (cost)
FROM ( SELECT week,vendor,customer,SUM (cost) cost
FROM (SELECT CASE
WHEN TO_NUMBER (TO_CHAR (TRUNC (supply_date), 'DD')) BETWEEN 1 AND 7 THEN
'01/01/2012 to 07/01/2012'
WHEN TO_NUMBER (TO_CHAR (TRUNC (supply_date), 'DD')) BETWEEN 8 AND 14 THEN
'08/01/2012 to 14/01/2012'
WHEN TO_NUMBER (TO_CHAR (TRUNC (supply_date), 'DD')) BETWEEN 15 AND 21 THEN
'15/01/2012 to 21/01/2012'
WHEN TO_NUMBER (TO_CHAR (TRUNC (supply_date), 'DD')) BETWEEN 22 AND 28 THEN
'22/01/2012 to 28/01/2012'
WHEN TO_NUMBER (TO_CHAR (TRUNC (supply_date), 'DD')) BETWEEN 29 AND 31 THEN
'29/01/2012 to 31/01/2012'
END
week,vendor,customer,cost
FROM report)
GROUP BY week, vendor, customer
UNION ALL
SELECT tw.week,vendor,customer,0
FROM ( SELECT week,vendor,customer,SUM (cost) cost
FROM (SELECT CASE
WHEN TO_NUMBER (TO_CHAR (TRUNC (supply_date), 'DD')) BETWEEN 1 AND 7 THEN
'01/01/2012 to 07/01/2012'
WHEN TO_NUMBER (TO_CHAR (TRUNC (supply_date), 'DD')) BETWEEN 8 AND 14 THEN
'08/01/2012 to 14/01/2012'
WHEN TO_NUMBER (TO_CHAR (TRUNC (supply_date), 'DD')) BETWEEN 15 AND 21 THEN
'15/01/2012 to 21/01/2012'
WHEN TO_NUMBER (TO_CHAR (TRUNC (supply_date), 'DD')) BETWEEN 22 AND 28 THEN
'22/01/2012 to 28/01/2012'
WHEN TO_NUMBER (TO_CHAR (TRUNC (supply_date), 'DD')) BETWEEN 29 AND 31 THEN
'29/01/2012 to 31/01/2012'
END
week,vendor,customer,cost
FROM report)
GROUP BY week, vendor, customer),temp_week tw)
GROUP BY week, vendor, customer
ORDER BY vendor, customer, week ;
with above query i am getting below output:
with output as(
select '01/01/2012 to 07/01/2012' as week,'vendor_1' as vendor,'customer_1' as customer, 500 as cost from dual union all
select '08/01/2012 to 14/01/2012' as week,'vendor_1' as vendor,'customer_1' as customer, 200 as cost from dual union all
select '15/01/2012 to 21/01/2012' as week,'vendor_1' as vendor,'customer_1' as customer, 0 as cost from dual union all
select '22/01/2012 to 28/01/2012' as week,'vendor_1' as vendor,'customer_1' as customer, 0 as cost from dual union all
select '29/01/2012 to 31/01/2012' as week,'vendor_1' as vendor,'customer_1' as customer, 0 as cost from dual union all
select '01/01/2012 to 07/01/2012' as week,'vendor_1' as vendor,'customer_2' as customer, 330 as cost from dual union all
select '08/01/2012 to 14/01/2012' as week,'vendor_1' as vendor,'customer_2' as customer, 370 as cost from dual union all
select '15/01/2012 to 21/01/2012' as week,'vendor_1' as vendor,'customer_2' as customer, 300 as cost from dual union all
select '22/01/2012 to 28/01/2012' as week,'vendor_1' as vendor,'customer_2' as customer, 0 as cost from dual union all
select '29/01/2012 to 31/01/2012' as week,'vendor_1' as vendor,'customer_2' as customer, 0 as cost from dual )
Clearly I have used cross join. But I want to get same output with some other way. I dont want to use cross join and Union
please help me in this.DUPLICATE!
SQL Query help. -
How to compare a boolean value returned from a function in a sql query
Hi all
i have a function which return boolean true or false.
mean while i am writing a sql query which should check this function and will return a result set only when it is true. how will i use a function which returns boolean in a sql query..
thanks in advance'
HariI don't think this is possible - i'm not sure. Can you post your function script? The reason why am i asking this is --
satyaki>set serveroutput on
satyaki>
satyaki>
satyaki>
satyaki>create or replace function test_satf(emno in number)
2 return boolean
3 is
4 v_cnt number(5);
5 v_flg boolean;
6 begin
7 select count(*)
8 into v_cnt
9 from emp
10 where empno = emno;
11
12 if v_cnt = 1 then
13 v_flg := TRUE;
14 else
15 v_flg := FALSE;
16 end if;
17
18 return v_flg;
19 exception
20 when others then
21 v_flg := FALSE;
22 return v_flg;
23 end;
24 /
Function created.
satyaki>
satyaki>
satyaki>
satyaki>
satyaki>
satyaki>desc emp;
Name Null? Type
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
satyaki>
satyaki>
satyaki>
satyaki>select count(*) from emp;
COUNT(*)
14
satyaki>
satyaki>select empno,test_satf(empno)
2 from emp;
select empno,test_satf(empno)
ERROR at line 1:
ORA-06552: PL/SQL: Statement ignored
ORA-06553: PLS-382: expression is of wrong type
satyaki>select to_char(test_satf(empno))
2 from emp;
select to_char(test_satf(empno))
ERROR at line 1:
ORA-06552: PL/SQL: Statement ignored
ORA-06553: PLS-382: expression is of wrong type
satyaki>
satyaki>create or replace function test_satf(emno in number)
2 return varchar2
3 is
4 v_cnt number(5);
5 v_flg varchar2(10);
6 begin
7 select count(*)
8 into v_cnt
9 from emp
10 where empno = emno;
11
12 if v_cnt = 1 then
13 v_flg := 'TRUE';
14 else
15 v_flg := 'FALSE';
16 end if;
17
18 return v_flg;
19 exception
20 when others then
21 v_flg := 'FALSE';
22 return v_flg;
23 end;
24 /
Function created.
satyaki>
satyaki>
satyaki>select test_satf(empno)
2 from emp;
TEST_SATF(EMPNO)
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TEST_SATF(EMPNO)
TRUE
TRUE
TRUE
14 rows selected.Or, may be i'm missing something.
Regards.
Satyaki De. -
How to compare same SQL query performance in different DB servers.
We have Production and Validation Environment of Oracle11g DB on two Solaris OSs.
H/W and DB,etc configurations of two Oracle DBs are almost same in PROD and VAL.
But we detected large SQL query performace difference in PROD DB and VAL DB in same SQL query.
I would like to find and solve the cause of this situation.
How could I do that ?
I plan to compare SQL execution plan in PROD and VAL DB and index fragmentations.
Before that I thought I need to keep same condition of DB statistics information in PROD and VAL DB.
So, I plan to execute alter system FLUSH BUFFER_CACHE;
But I am worring about bad effects of alter system FLUSH BUFFER_CACHE; to end users
If we did alter system FLUSH BUFFER_CACHE; and got execution plan of that SQL query in the time end users do not use that system ,
there is not large bad effect to end users after those operations?
Could you please let me know the recomendation to compare SQL query performace ?Thank you.
I got AWR report for only VAL DB server but it looks strange.
Is there any thing wrong in DB or how to get AWR report ?
Host Name
Platform
CPUs
Cores
Sockets
Memory (GB)
xxxx
Solaris[tm] OE (64-bit)
.00
Snap Id
Snap Time
Sessions
Cursors/Session
Begin Snap:
xxxx
13-Apr-15 04:00:04
End Snap:
xxxx
14-Apr-15 04:00:22
Elapsed:
1,440.30 (mins)
DB Time:
0.00 (mins)
Report Summary
Cache Sizes
Begin
End
Buffer Cache:
M
M
Std Block Size:
K
Shared Pool Size:
0M
0M
Log Buffer:
K
Load Profile
Per Second
Per Transaction
Per Exec
Per Call
DB Time(s):
0.0
0.0
0.00
0.00
DB CPU(s):
0.0
0.0
0.00
0.00
Redo size:
Logical reads:
0.0
1.0
Block changes:
0.0
1.0
Physical reads:
0.0
1.0
Physical writes:
0.0
1.0
User calls:
0.0
1.0
Parses:
0.0
1.0
Hard parses:
W/A MB processed:
16.7
1,442,472.0
Logons:
Executes:
0.0
1.0
Rollbacks:
Transactions:
0.0
Instance Efficiency Percentages (Target 100%)
Buffer Nowait %:
Redo NoWait %:
Buffer Hit %:
In-memory Sort %:
Library Hit %:
96.69
Soft Parse %:
Execute to Parse %:
0.00
Latch Hit %:
Parse CPU to Parse Elapsd %:
% Non-Parse CPU:
Shared Pool Statistics
Begin
End
Memory Usage %:
% SQL with executions>1:
34.82
48.31
% Memory for SQL w/exec>1:
63.66
73.05
Top 5 Timed Foreground Events
Event
Waits
Time(s)
Avg wait (ms)
% DB time
Wait Class
DB CPU
0
100.00
Host CPU (CPUs: Cores: Sockets: )
Load Average Begin
Load Average End
%User
%System
%WIO
%Idle
Instance CPU
%Total CPU
%Busy CPU
%DB time waiting for CPU (Resource Manager)
Memory Statistics
Begin
End
Host Mem (MB):
SGA use (MB):
46,336.0
46,336.0
PGA use (MB):
713.6
662.6
% Host Mem used for SGA+PGA:
Time Model Statistics
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Operating System Statistics
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Operating System Statistics - Detail
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Foreground Wait Class
s - second, ms - millisecond - 1000th of a second
ordered by wait time desc, waits desc
%Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
Captured Time accounts for % of Total DB time .00 (s)
Total FG Wait Time: (s) DB CPU time: .00 (s)
Wait Class
Waits
%Time -outs
Total Wait Time (s)
Avg wait (ms)
%DB time
DB CPU
0
100.00
Back to Wait Events Statistics
Back to Top
Foreground Wait Events
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Background Wait Events
ordered by wait time desc, waits desc (idle events last)
Only events with Total Wait Time (s) >= .001 are shown
%Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
Event
Waits
%Time -outs
Total Wait Time (s)
Avg wait (ms)
Waits /txn
% bg time
log file parallel write
527,034
0
2,209
4
527,034.00
db file parallel write
381,966
0
249
1
381,966.00
os thread startup
2,650
0
151
57
2,650.00
latch: messages
125,526
0
89
1
125,526.00
control file sequential read
148,662
0
54
0
148,662.00
control file parallel write
41,935
0
28
1
41,935.00
Log archive I/O
5,070
0
14
3
5,070.00
Disk file operations I/O
8,091
0
10
1
8,091.00
log file sequential read
3,024
0
6
2
3,024.00
db file sequential read
1,299
0
2
2
1,299.00
latch: shared pool
722
0
1
1
722.00
enq: CF - contention
4
0
1
208
4.00
reliable message
1,316
0
1
1
1,316.00
log file sync
71
0
1
9
71.00
enq: CR - block range reuse ckpt
36
0
0
13
36.00
enq: JS - queue lock
459
0
0
1
459.00
log file single write
414
0
0
1
414.00
enq: PR - contention
5
0
0
57
5.00
asynch descriptor resize
67,076
100
0
0
67,076.00
LGWR wait for redo copy
5,184
0
0
0
5,184.00
rdbms ipc reply
1,234
0
0
0
1,234.00
ADR block file read
384
0
0
0
384.00
SQL*Net message to client
189,490
0
0
0
189,490.00
latch free
559
0
0
0
559.00
db file scattered read
17
0
0
6
17.00
resmgr:internal state change
1
100
0
100
1.00
direct path read
301
0
0
0
301.00
enq: RO - fast object reuse
35
0
0
2
35.00
direct path write
122
0
0
1
122.00
latch: cache buffers chains
260
0
0
0
260.00
db file parallel read
1
0
0
41
1.00
ADR file lock
144
0
0
0
144.00
latch: redo writing
55
0
0
1
55.00
ADR block file write
120
0
0
0
120.00
wait list latch free
2
0
0
10
2.00
latch: cache buffers lru chain
44
0
0
0
44.00
buffer busy waits
3
0
0
2
3.00
latch: call allocation
57
0
0
0
57.00
SQL*Net more data to client
55
0
0
0
55.00
ARCH wait for archivelog lock
78
0
0
0
78.00
rdbms ipc message
3,157,653
40
4,058,370
1285
3,157,653.00
Streams AQ: qmn slave idle wait
11,826
0
172,828
14614
11,826.00
DIAG idle wait
170,978
100
172,681
1010
170,978.00
dispatcher timer
1,440
100
86,417
60012
1,440.00
Streams AQ: qmn coordinator idle wait
6,479
48
86,413
13337
6,479.00
shared server idle wait
2,879
100
86,401
30011
2,879.00
Space Manager: slave idle wait
17,258
100
86,324
5002
17,258.00
pmon timer
46,489
62
86,252
1855
46,489.00
smon timer
361
66
86,145
238628
361.00
VKRM Idle
1
0
14,401
14400820
1.00
SQL*Net message from client
253,909
0
419
2
253,909.00
class slave wait
379
0
0
0
379.00
Back to Wait Events Statistics
Back to Top
Wait Event Histogram
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Wait Event Histogram Detail (64 msec to 2 sec)
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Wait Event Histogram Detail (4 sec to 2 min)
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Wait Event Histogram Detail (4 min to 1 hr)
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Service Statistics
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Service Wait Class Stats
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
SQL Statistics
SQL ordered by Elapsed Time
SQL ordered by CPU Time
SQL ordered by User I/O Wait Time
SQL ordered by Gets
SQL ordered by Reads
SQL ordered by Physical Reads (UnOptimized)
SQL ordered by Executions
SQL ordered by Parse Calls
SQL ordered by Sharable Memory
SQL ordered by Version Count
Complete List of SQL Text
Back to Top
SQL ordered by Elapsed Time
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by CPU Time
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by User I/O Wait Time
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Gets
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Reads
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Physical Reads (UnOptimized)
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Executions
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Parse Calls
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Sharable Memory
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Version Count
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
Complete List of SQL Text
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
Instance Activity Statistics
Instance Activity Stats
Instance Activity Stats - Absolute Values
Instance Activity Stats - Thread Activity
Back to Top
Instance Activity Stats
No data exists for this section of the report.
Back to Instance Activity Statistics
Back to Top
Instance Activity Stats - Absolute Values
No data exists for this section of the report.
Back to Instance Activity Statistics
Back to Top
Instance Activity Stats - Thread Activity
Statistics identified by '(derived)' come from sources other than SYSSTAT
Statistic
Total
per Hour
log switches (derived)
69
2.87
Back to Instance Activity Statistics
Back to Top
IO Stats
IOStat by Function summary
IOStat by Filetype summary
IOStat by Function/Filetype summary
Tablespace IO Stats
File IO Stats
Back to Top
IOStat by Function summary
'Data' columns suffixed with M,G,T,P are in multiples of 1024 other columns suffixed with K,M,G,T,P are in multiples of 1000
ordered by (Data Read + Write) desc
Function Name
Reads: Data
Reqs per sec
Data per sec
Writes: Data
Reqs per sec
Data per sec
Waits: Count
Avg Tm(ms)
Others
28.8G
20.55
.340727
16.7G
2.65
.198442
1803K
0.01
Direct Reads
43.6G
57.09
.517021
411M
0.59
.004755
0
LGWR
19M
0.02
.000219
41.9G
21.87
.496493
2760
0.08
Direct Writes
16M
0.00
.000185
8.9G
1.77
.105927
0
DBWR
0M
0.00
0M
6.7G
4.42
.079670
0
Buffer Cache Reads
3.1G
3.67
.037318
0M
0.00
0M
260.1K
3.96
TOTAL:
75.6G
81.33
.895473
74.7G
31.31
.885290
2065.8K
0.51
Back to IO Stats
Back to Top
IOStat by Filetype summary
'Data' columns suffixed with M,G,T,P are in multiples of 1024 other columns suffixed with K,M,G,T,P are in multiples of 1000
Small Read and Large Read are average service times, in milliseconds
Ordered by (Data Read + Write) desc
Filetype Name
Reads: Data
Reqs per sec
Data per sec
Writes: Data
Reqs per sec
Data per sec
Small Read
Large Read
Data File
53.2G
78.33
.630701
8.9G
7.04
.105197
0.37
21.51
Log File
13.9G
0.18
.164213
41.9G
21.85
.496123
0.02
2.93
Archive Log
0M
0.00
0M
13.9G
0.16
.164213
Temp File
5.6G
0.67
.066213
8.1G
0.80
.096496
5.33
3713.27
Control File
2.9G
2.16
.034333
2G
1.46
.023247
0.05
19.98 -
SQL Query to find cumulative values for a Financial Year
Dear users,
My requirement is to create a SQL query for a table/view where I have day-wise data. I want to find out cumulative values for financial year by giving any date. It should add the values from start of financial year till that date in the financial year.
I think creating a view of such type will post heavy burden on resources since accuimulation will be done for each day upto that day.
ThanksDear users,
My requirement is to create a SQL query for a
table/view where I have day-wise data. I want to
find out cumulative values for financial year by
giving any date. It should add the values from start
of financial year till that date in the financial
year.
I think creating a view of such type will post heavy
burden on resources since accuimulation will be done
for each day upto that day.
ThanksKumar's solution will serve yours purpose but m not agreed
I think creating a view of such type will post heavy
burden on resources since accuimulation will be done
for each day upto that day. Khurram -
Reg: sql query that prints all sundays in the year
Hi all,
Please give me sql query that prints all sundays in year. And when ever we execute that query then that will prints the sysdate(that is execution date).
Thanks in Advance,
-prasad.
Edited by: prasad_orcl on Jun 5, 2009 9:13 PMHi,
Plz try this and let me know this works or not...
SELECT DATE DATES,TO_CHAR(DATE,'DAY') DAYS FROM FISCAL_CALENDAR
WHERE DATE_YEAR = 2009 AND
DATE BETWEEN TRUNC(SYSDATE,'YEAR') AND
ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),12) -1 AND
TRIM(TO_CHAR(DATE,'DAY')) = 'SUNDAY'
ORDER BY DATE
OUTPUT:
DATES DAYS
1/4/2009 SUNDAY
1/11/2009 SUNDAY
1/18/2009 SUNDAY
1/25/2009 SUNDAY
2/1/2009 SUNDAY
2/8/2009 SUNDAY
2/15/2009 SUNDAY
2/22/2009 SUNDAY
3/1/2009 SUNDAY
3/8/2009 SUNDAY
3/15/2009 SUNDAY
3/22/2009 SUNDAY
3/29/2009 SUNDAY
4/5/2009 SUNDAY
4/12/2009 SUNDAY
4/19/2009 SUNDAY
4/26/2009 SUNDAY
5/3/2009 SUNDAY
5/10/2009 SUNDAY
5/17/2009 SUNDAY
5/24/2009 SUNDAY
5/31/2009 SUNDAY
6/7/2009 SUNDAY
6/14/2009 SUNDAY
6/21/2009 SUNDAY
6/28/2009 SUNDAY
7/5/2009 SUNDAY
7/12/2009 SUNDAY
7/19/2009 SUNDAY
7/26/2009 SUNDAY
8/2/2009 SUNDAY
8/9/2009 SUNDAY
8/16/2009 SUNDAY
8/23/2009 SUNDAY
8/30/2009 SUNDAY
9/6/2009 SUNDAY
9/13/2009 SUNDAY
9/20/2009 SUNDAY
9/27/2009 SUNDAY
10/4/2009 SUNDAY
10/11/2009SUNDAY
10/18/2009SUNDAY
10/25/2009SUNDAY
11/1/2009 SUNDAY
11/8/2009 SUNDAY
11/15/2009SUNDAY
11/22/2009SUNDAY
11/29/2009SUNDAY
12/6/2009 SUNDAY
12/13/2009SUNDAY
12/20/2009SUNDAY
12/27/2009SUNDAY
Regards
Thiyag
Maybe you are looking for
-
I have a user on an iMac 10.6 connected to our domain. She uses Outlook web access for email on our exchange server. Last week she received the following message which is randomly preventing her from sending emails. She claims no attachment was in
-
Hi, I have an application based on flash builder 3 with SDK 3.2. I try to import this application to Flash builder 4.6 with SDK 3.6, but in design mode, I have a black screen. Anyone have a solution for that ?
-
Unable to connect JAVA with Oracle
I have jdk1.6 and oracle installed on my machine but unable to connect java with database have classes12.jar and ojdbc14.jar my environmental variables in respect to this are : JAVA_HOME= C:\Java\jdk1.6.0_04 JRE_HOME=C:\Java\jdk1.6.0_04 PATH=J:\oracl
-
Wondering if someone could offer some assistance. My Mac boots up fine, but immediately freezes (including mouse cursor) once it's at the main screen. After about a minute, the fan gets very loud and there is nothing I can do but hold down the power
-
Re: File extension dejavu
Hi, I have downloaded some ebooks in pdf format and dejavu. I can open pdf files with adobe reader but don't know for dejavu extension. How to open dejavu files? Any help appreciated. Thanks