Solved

oracle query

Posted on 2013-07-01
4
276 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.

Question has a verified solution.

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

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to recover a database from a user managed backup

831 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