Solved

oracle query

Posted on 2013-07-01
4
277 Views
Last Modified: 2013-07-01
CREATE TABLE TAB1
(
  DAY_SUNDAY     NUMBER(4),
  DAY_MONDAY     NUMBER(4),
  DAY_TUESDAY    NUMBER(4),
  DAY_WEDNESDAY  NUMBER(4),
  DAY_THURSDAY   NUMBER(4),
  DAY_FRIDAY     NUMBER(4),
  DAY_SATURDAY   NUMBER(4),
  BLOOD_TYPE     NUMBER
)



Insert into TAB1
   (DAY_SUNDAY, DAY_MONDAY, DAY_TUESDAY, DAY_WEDNESDAY, DAY_THURSDAY,
    DAY_FRIDAY, DAY_SATURDAY, BLOOD_TYPE)
 Values
   (10, 11, 12, 13, 14,
    15, 16, 84);
Insert into TAB1
   (DAY_SUNDAY, DAY_MONDAY, DAY_TUESDAY, DAY_WEDNESDAY, DAY_THURSDAY,
    DAY_FRIDAY, DAY_SATURDAY, BLOOD_TYPE)
 Values
   (20, 21, 22, 23, 24,
    25, 26, 28);
Insert into TAB1
   (DAY_SUNDAY, DAY_MONDAY, DAY_TUESDAY, DAY_WEDNESDAY, DAY_THURSDAY,
    DAY_FRIDAY, DAY_SATURDAY, BLOOD_TYPE)
 Values
   (30, 31, 32, 33, 34,
    35, 36, 62);
Insert into TAB1
   (DAY_SUNDAY, DAY_MONDAY, DAY_TUESDAY, DAY_WEDNESDAY, DAY_THURSDAY,
    DAY_FRIDAY, DAY_SATURDAY, BLOOD_TYPE)
 Values
   (40, 41, 42, 43, 44,
    45, 46, 6);
Insert into TAB1
   (DAY_SUNDAY, DAY_MONDAY, DAY_TUESDAY, DAY_WEDNESDAY, DAY_THURSDAY,
    DAY_FRIDAY, DAY_SATURDAY, BLOOD_TYPE)
 Values
   (50, 51, 52, 53, 54,
    55, 56, 73);
Insert into TAB1
   (DAY_SUNDAY, DAY_MONDAY, DAY_TUESDAY, DAY_WEDNESDAY, DAY_THURSDAY,
    DAY_FRIDAY, DAY_SATURDAY, BLOOD_TYPE)
 Values
   (70, 71, 72, 73, 74,
    75, 76, 51);
Insert into TAB1
   (DAY_SUNDAY, DAY_MONDAY, DAY_TUESDAY, DAY_WEDNESDAY, DAY_THURSDAY,
    DAY_FRIDAY, DAY_SATURDAY, BLOOD_TYPE)
 Values
   (60, 61, 62, 63, 64,
    65, 66, 95);
COMMIT;

---------------------------------------

Required data is

I want the data to be displayed they way I have attached the screen print.

Daya as columns and blood type as rows.
screen-print.JPG
0
Comment
Question by:anumoses
  • 2
  • 2
4 Comments
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39291280
I'm not seeing anything 'special' about your expected output aside from the day data missing.

Can you explain a little more about what you are wanting.
0
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 250 total points
ID: 39291292
It looks like a straight select?

select BLOOD_TYPE, DAY_SUNDAY, DAY_MONDAY, DAY_TUESDAY, DAY_WEDNESDAY, DAY_THURSDAY, DAY_FRIDAY, DAY_SATURDAY
from tab1
order by blood_type;
0
 
LVL 6

Author Comment

by:anumoses
ID: 39291302
I did the same and just wanted to confirm. Thanks,
0
 
LVL 6

Author Closing Comment

by:anumoses
ID: 39291305
thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sybase and replication server 13 39
oracle forms question 22 42
Oracle cursor lifecycle inside procedure. 2 13
Oracle Nested table uses ? 2 35
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question