Google
Information Storage and Retrieval: Exploding Rows........

Pages

Tuesday, June 5, 2012

Exploding Rows........

SQL Puzzle:


You have a table with 2 columns: literal and num with data as shown below:


Literal     NUM
 a                 4
 b                 3
 c                 2


Write a query that returns the output as:


Literal
----------
   a
   a
   a
   a
   b
   b
   b
   c
   c


The NUM represents the number of times the literal has to be repeated in the output




Solution:


The query will be as follows:


select a.literal
from
(select literal, num from explode) a, (select rownum rn from user_objects) b
where b.rn<=a.num



11 comments:

Anonymous said...

Howdy, i read your blog occasionally and i own a similar one and
i was just curious if you get a lot of spam remarks?
If so how do you protect against it, any plugin or anything you can recommend?
I get so much lately it's driving me insane so any help is very much appreciated.

my weblog :: dar01726mc.wallinside.com

Anonymous said...

Pls for your kindness deliver me the video clip hint of making pcb with hp
printer.

Have a look at my web-site ... xerox phaser 8560 ink sticks

Anonymous said...

I'm more than happy to find this great site. I wanted to thank you for ones time just for this fantastic read!! I definitely liked every little bit of it and I have you book marked to look at new stuff in your site. I hope you don't mind, I bookmarked Blogger: Information Storage and
Retrieval at Pinterest so my coworkers will
see it too. May I also share a tip. Acquiring excellent video marketing could possibly be highly tough.
I find it most valuable to talk to a a Great Estate Planning Lawyers San
Diego. Our staff of Bankruptcy Lawyer San Diego are right here to help with all of your legal requirements.


Also visit my website: Top San Diego Bankruptcy Attorney

Anonymous said...

Hey there would you mind letting me know which webhost you're working with? I've loaded your blog in 3 completely different browsers and I must say this blog loads a lot quicker then most.
Can you suggest a good internet hosting provider at a honest price?
Thanks a lot, I appreciate it!

My web page: ink for xerox phaser 8560

Anonymous said...

Apologies if the chart is unclear. It's new and your comments is valued. Printing right here is self-service and suggested to offer developers a hands-on, reduced cost choice. Designers need to enroll in one of the membership plans prior to printing. If you're looking to send out
files and have your task published for you, I could recommend printing shop in
Divine superintendence that can do this.

Also visit my blog post ... xerox phaser 8560 maintenance kit

Anonymous said...

7, 2012 50th Bangkok Gems & Jewelry Fair : Amazes worldwide which consists of golden

Also visit my website: hertaraftar.com

Anonymous said...

Extremely useful article. However, the price colour
and multifunction colour laser printers ought to have been addressed.
They're still more costly than inkjet printers although worth the extra expenses.

my webpage - xerox phaser 8560n

Anonymous said...

Thank you for establishing this web site.
The tales right here cost reading many times over in
order to revitalize us over and over again to do good and positive points and influence or influence others to do the
same.

Here is my web site; xerox phaser 8560 ink

Anonymous said...

Spot on with this write-up, I really believe that this amazing site needs far more attention.
I'll probably be back again to read more, thanks for the info!

Stop by my web blog :: myfavouritejewellery.weebly.com

Anonymous said...

Changed the cartridge, same issue with grinding. Don't know exactly what to do because its 6 years aged, and no actual repair locations. I may tear it apart and look at it. Thanks.

my website - xerox phaser 8560 maintenance kit :: ::

Anonymous said...

Yes! Finally something about pisces horoscope dates.


Look into my web page voyance en direct