Solved

oracle query

Posted on 2013-07-01
4
272 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 76

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 76

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.

Join & Write a Comment

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now