tag:blogger.com,1999:blog-300351032024-03-14T09:09:25.165+05:30SQL puzzles. . .Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.comBlogger40125tag:blogger.com,1999:blog-30035103.post-39334500785070357632013-11-30T17:47:00.001+05:302014-03-31T17:37:16.967+05:30ORA-00960:Ambiguous column naming in select list<div dir="ltr" style="text-align: left;" trbidi="on">
Ambiguous column error in oracle is a very familiar one as almost every oracle developer come across this error. But I recently got slapped by this error when I had duplicate column names in sub-query.<br />
Let us go through a simple example on this,<br />
<br />
The below query returns two columns and both with the same name TO_DATE,<br />
<br />
<span style="background-color: white;"><span style="color: #3d85c6;">SELECT SYSDATE TO_DAY, SYSTIMESTAMP TO_DAY<br />FROM DUAL;</span></span><br />
<br />
<br />
It works perfectly fine. But the moment when you put the same query as a sub-query of another like the one below oracle will show a RED card on you.<br />
<span style="color: #3d85c6;"><br /></span>
<span style="color: #3d85c6;"><span style="background-color: white;">SELECT *<br />FROM (SELECT SYSDATE TO_DAY, SYSTIMESTAMP TO_DAY<br /> FROM DUAL);</span></span><br />
<br />
I was taken aback by this error for a moment and then it struck my mind why I got this error. Its fine to have duplicate columns in the main query. But the moment it becomes a sub-query, it will be treated like a table (in-line view). We can't have duplicate columns in a table/view. So it make sense to get an error when your sub-query have duplicate column names.<br />
<br /></div>
Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-32439954481921518112013-04-19T02:54:00.001+05:302013-04-19T02:55:16.776+05:30IPL6: Who will reach Qualifiers?<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
IPL6 is a hit already with only one third of league games just got concluded. This season has already seen some fascinating contests, last ball finishes, hat-tricks, super overs and also some one-sided games. Overall this season has something special over the earlier versions due to the kind of balanced pitches used during this tournament so far. Unlike earlier versions, pitches being used in this season provides equal opportunities to both bowlers and batsmen and I am even tempted to say bowlers have enjoyed more success than batsmen so far.<br />
<br />
Having played at least 5 games apiece every team divulged their strengths and their weaknesses too are exposed. With handful results in hand predicting top 4 teams of this season now is fairly easier than doing this exercise before match one. At the same time its also difficult to precisely predict 4 out off 4 as this format is so unpredictable that a single player could beat a strong team on his day. So it will be fun comparing what you had predicted earlier with what had actually happened at the end of the tournament. That is exactly what I am trying to do. <br />
<br />
The shocking surprise of this tournament is team Delhi Daredevils. Its inexplicable to figure out what is going wrong to this team. Perhaps they had lost both KP and Jessy before this season begins. But that does not explain this dismal performance as this team still have got number of match winners.They neither a weak team to loose 6 manes in a row nor have a strong batting line up to win 9 out off 10 games to push them to top 4. I hope they would have stop thinking (even stop dreaming) about getting qualified for knock out stages. Now their objective should be finding a decent position in bottom of the table at the end and if possible crushing some one's semifinal dream. Base on my observation chances for this team to make to the knock out stages is 5% <br />
<br />
Next is the <b>Kings XI Punjab</b>(10% of chances). This is the only team which I am sure will not advance to the next stage. They do not have the right team to be consistent through out this tournament. I am sure they are going to slump sooner than later as the tournament progresses.<br />
<b><br />Sunrisers Hyderabad(20%):</b> It is good to see them having more than a decent debut season so far. Sunriser's strength is their bowling which could comfortably challenge any strong batting line up particularly in this season which offers something to every one. but their batting is too weak to match their substantial bowling line up. I give 20% to this team only for their bowling.<br />
<br />
<b>Pune Warriers (35%):</b> YUVI,Uthapa,Bhuvneshwar Kumar, Rahul Sharma,Ashok Dinda,Manish Panday, Abhishek Nayar and Mithun Manhas. Interesting list is not it. This team consist of notable names to fill 7 domestic players slots and also names on overseas list also quite good. By and large they are strong team on papers but the results do not reflect the same. Unfortunately this team had suffered more losses (11 on the trot) which would play a huge role on their confidence and current form of some of the players and notably their captain's form are all worrying sign for this paper tigers.<br />
<br />
<b>Rajasthan Royals (50%):</b> A team of thoughtfully picked overseas players, Handful of Indian international players and bits&pieces crickets who can chip in. This team can perform more than what is expected on them. Unlike RCB or MI this does not posses many big names on their squad but its a decent team who can beat any team on their day. Having lead by MR.Cricket who has been consistent in every IPL season Rajasthan Royals could surprise many by reaching next stage.<br />
<br />
<br />
<br />
<b>KKR(65%):</b> Defending champions. Possess a rich group of overseas players. Their lower middle order is weaker and they largely dependent on Sunil Narine for wickets.<br />
they may sweat a lot to earn the semifinal spot from Rajasthan and Pune.<br />
<br />
<b>Mumbai Indians(75%):</b> Overall a very good team. Depth in their batting order is their biggest strength. The biggest concern is their not firing opening pair. undoubtedly they are nonpareil opening pair yet to open their account. You may expect them to catch up as the tournament progresses. Except Dinesh Karthik all their batsmen have been fairly inconsistent. As this team possess everything a strong team should need you can see them sail through comfortably<br />
<br />
<b>RCB(90%):</b> T20 is the game uncertainty and this team had proved this number of occasions. They posses a fearsome top order batsmen and to add more all three of them are in peak of their form. At the same time whenever their middle order is exposed they fail to impress and let their team down. Their neither strong nor weak bowling unit may let the team down on their bad day.<br />
<br />
<b>CSK(90%):</b> Generally know as slow starters, but CSK have started this season strongly. Current form of most of the players is good and almost all of them have made notable contribution to boost their confidence. So you may expect them to grow stronger and stronger. <br />
<br />
I love to come back on 19th May and LOL at me</div>
Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-2178916130411081272013-04-17T00:47:00.004+05:302013-04-17T00:51:31.169+05:30You are invited to join my IPL Fantasy league...<div dir="ltr" style="text-align: left;" trbidi="on">
Yes. IPL fantasy leagues is the best solution to your cricketing itch as thay claim. Its indeed an arousing challenge to any craziest cricket follower. And the good part is that you can team up and have league with you. have not you enrolled for fantasy league yet? Do not think you are late. Certainly you have not lost much of the contest as we have gone past just 25% of the league stages. If you start now, you will be given 80 substitutions to make + 1 free uncapped player sub for each game. So If you have a right strategy worked out and have a thirst to have fun then join my fantasy league <span style="color: #073763;">"Starts of IPL (league code:24479)"</span>. <br />
<br />
Wish you happy gaming.<br />
<br />
FAQs of Fantasy league:: https://fantasy.iplt20.com/ifl/default/faq</div>
Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-81171331599756436382013-03-17T01:49:00.002+05:302013-03-17T01:49:45.825+05:30Are we ready with new Shewag-Gambhir combination?<div dir="ltr" style="text-align: left;" trbidi="on">
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-IN</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}
</style>
<![endif]-->
<br />
<div class="MsoNormal">
Are we ready with new Shewag-Gambhir combination?</div>
<div class="MsoNormal">
I have doubt it is still early days to compare our brand new
opening pair of Dhawan-Vijay with Shewag-Gambhir. It may sound injustice to
many. But this pair looks very assured and has more reasons to compare with
their long term predecessors.</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Today, it could be the pitch or an average bowling for
Aussies or anything…but Dhawan deserves huge credit for such a fantabulous innings.
This innings have just made us to think result is still possible in this match
against India’s favour else it would have been a dull draw. Shewag did this
before many times. Now a new hope, we have got a new guy who can play a game
changing innings. </div>
<div class="MsoNormal">
At the same moment I feel sorry for Aussies who are
preparing for two back-to-back Ashes series during second half of this year.
Aussies need to address so many gaps with not much cricket left before Ashes.
Being a strong Aussie supporter when it comes to Ashes, I wish something
special happens to Australia something similar to resurgence of Watson two
years back. I would be glad if it is their long term spinner. </div>
</div>
Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-79593062128751130242012-04-03T18:52:00.003+05:302012-04-03T18:54:39.664+05:30Lockers...<div dir="ltr" style="text-align: left;" trbidi="on">
Generally you don't inspired with every puzzle that you solve. Every body would have seen handful of puzzles that made them elevated fore few moment. All of them will introduces something new to us. It is not the feeling of solving the puzzle makes a puzzle solver excited instead the wisdom it brought in indeed make it more thrilling experience. Here is the one such puzzle...<br />
<br />
<span style="font-size: large;"><br /></span><br />
<span style="font-size: large;"><i>There are 1000 lockers in a high school with 1000 students. The problem begins with the first student opening all 1000 lockers; next the second student closes lockers 2,4,6,8,10 and so on to locker 1000; the third student changes the state (opens lockers closed, closes lockers open) on lockers 3,6,9,12,15 and so on; the fourth student changes the state of lockers 4,8,12,16 and so on. This goes on until every student has had a turn. How many lockers will be open at the end?</i></span><br />
<br />
<br />
<br />
Locker 1 will remain open for sure<br />
Locker 2 will be closed (opened by 1 and closed by 2)<br />
Locker 3 will also be closed<br />
Locker 4 will be open (opened by 1, closed by 2 and opened by 4)<br />
Locker 5 - closed (1-5)<br />
Locker 6 - closed ( 1-2-3-6) <br />
Locker 7 - closed (1-7)<br />
Locker 8 - closed (1-2-4-8)<br />
Locker 9 - open (1-3-9)<br />
<br />
One can easily come to a below conclusion by looking at the above iterations,<br />
<br />
numbers have even number of factors will be closed at the end and numbers having odd number of factors will remain open.<br />
<i><br /></i><br />
Now, the question is to get the list of numbers having odd number of factors. The below points are obvious when it comes to factors of a number<br />
<br />
1. every number has at least two factors (1 and the number itself)<br />
2. every factor can be paired with another factor in such a way that multiplying both the factor will be the number itself<br />
For instance, number 6 has four factors, 1,2,3 and 6<br />
here 1 can be paired with 6, 2 can be paired with 3.<br />
<br />
3. Total number of factors will be even if the paired factors are not same.<br />
<br />
In other words the number of factors are not even if any of the pairs have the same numbers ( for instance 2,2 for 4).<br />
<br />
if a factor pair contains the same number then the number must be a perfect square :).<br />
Also a number can not have two such factor pairs with identical number (which is obvious). <br />
<br />
Hence number of lockers those remain open will be perfect squares (perfect is not it :) ).<br />
So total number of lockers remain open is 31 (31^2 =961, 32^2= 1024 ). <br />
<br />
<br />
<br /></div>Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-87158318343945715862012-03-16T08:00:00.000+05:302012-03-16T10:52:40.172+05:30A simple For..Loop Puzzle<div dir="ltr" style="text-align: left;" trbidi="on">
What is the output of below pl/sql block?<br />
<br />
<div style="color: #351c75;">
<b>declare</b></div>
<div style="color: #351c75; text-align: left;">
<b>
var1 number(2) :=1;<br />
var2 number(2) :=5;<br />
begin<br />
for i in var1..var2 loop<br />
dbms_output.put_line( 'i,var2: ' || i || ','||var2);<br />
if i= 3 then<br />
var2 :=7;<br />
end if;<br /> end loop;<br />
end;</b></div>
<div style="color: #351c75; text-align: left;">
<br /></div>
<div style="color: #351c75; text-align: left;">
<br /></div>
<div style="color: #351c75; text-align: left;">
<br /></div>
<div style="color: #351c75; text-align: left;">
<span style="color: black;">The output of the above pl/sql block is,</span><b><br /></b></div>
<div style="color: #351c75; text-align: left;">
i,var2: 1,5<br />
i,var2: 2,5<br />
i,var2: 3,5<br />
i,var2: 4,7<br />
i,var2: 5,7<b> </b></div>
<div style="color: #351c75; text-align: left;">
<b><br /></b></div>
<div style="color: #351c75; text-align: left;">
<span style="color: black;">Surprised??</span><b> </b><span style="color: black;">One can argue that the loop should have been continued until i reaches the new value of var2, which is 7. The below extract from oracle documentation will silent the argument,</span><b><br /></b></div>
<div style="color: #351c75; text-align: left;">
<span class="italic"><br /></span>
</div>
<blockquote class="tr_bq">
<a href="http://www.blogger.com/blogger.g?blogID=30035103" id="sthref2156" name="sthref2156"></a><a href="http://www.blogger.com/blogger.g?blogID=30035103" id="sthref2157" name="sthref2157"></a><i>Numeric <code>FOR_LOOP</code> loops iterate over a specified range of integers. The range is part of an iteration scheme, which is enclosed by the keywords <code>FOR</code> and <code>LOOP</code>.</i><br />
<br />
<i><b>The range is evaluated when the <code>FOR</code> loop is first entered and is never re-evaluated</b>. The loop body is executed once for each integer in the range defined by <code>lower_bound</code>..<code>upper_bound</code>. After each iteration, the loop index is incremented.</i></blockquote>
</div>Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-25742231022063036722012-03-15T00:10:00.004+05:302012-03-15T00:17:13.508+05:30I lost my Boarding pass<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: small;">I used to hear people saying that the big challenge in problem solving lies in understanding the problem.The solution just follows that... This puzzle is a classical example.<br /><br /><b style="color: #351c75;">Question:</b><br /><br />On a sold out flight, 100 people line up to board the plane. The first passenger in the line has lost his boarding pass, but was allowed in, regardless. He takes a random seat. Each subsequent passenger takes his or her assigned seat if available, or a random unoccupied seat, otherwise. What is the probability that the last passenger to board the plane finds his seat unoccupied?<br /><br /><b style="color: #351c75;">Solution:</b><br /><br />One can make this very complex by starting from Passenger 1 to 100 and working out all possibilities.But this question is as simple as below,<br /><br />What is the probability for a passenger to get a specific seat among 100 seats? It is a simple probability question is not it?<br /><br />answer is : 99!/100! = 1/100 = 1%<br /><br />n(A) = other 99 seats can be occupied by other passengers = 99! ways.<br /><br />n(s) = number of ways 100 passengers can occupy 100 seats =100!<br /><br /><br /></span></div>Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-24306559986325296742012-03-08T00:28:00.000+05:302012-03-08T00:30:09.931+05:30Puzzle of 100 Bulbs...<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="font-family: inherit;">
<span style="font-size: small;">Just came across this puzzle in geekinterview.com,</span></div>
<div style="font-family: inherit;">
</div>
<div style="font-family: inherit;">
<span style="font-size: small;"><i>College has two rooms, one is having 100 bulbs and other room has its
switches. Switches doesn't have number/name written on it. New warden
doesn't know the switches for the bulbs. How many trips he has to make
to identify all the switches for the bulbs?</i></span></div>
<div style="font-family: inherit;">
<br /></div>
<div style="font-family: inherit;">
<span style="font-size: small;">And my answer to this puzzle is that he can do it in 20 trips...<br />
<br />
Here is my solution,<br />
1. Group 100 switches in to 10groups of 10 switches each.<br />
2. On all the switches in group 1, make a trip and note down the bulbs belong to that group<br />
3. Repeat step 2 for all the groups . That will make 10 trips and at the end of 10 trips bulbs also grouped along with switches. <br />
4. Now ON one switch in each group - 10 switches are on now<br />
5. make a visit and mark down the bulbs - now each bulb can be matched with its switch<br />
6. Repeat step 4 and 5 - for remaining 90 bulbs<br />
<br />
so by end of this 20 trips he will be able to match all 100 switches with the bulbs.</span></div>
<div style="font-family: inherit;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: inherit;">
<span style="font-size: small;">I am not sure whether it is possible to solve this problem with less than 20 trips. </span></div>
</div>Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-22697961663430676362012-03-06T22:43:00.001+05:302012-03-06T22:45:29.629+05:30Is DENSE_RANK an Analytic function or an Aggregate Function?<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="font-family: inherit;">
<span style="font-size: small;">Is DENSE_RANK an Analytic function or an Aggregate Function?</span></div>
<div style="font-family: inherit;">
<span style="font-size: small;"> </span>
</div>
<span style="font-family: inherit; font-size: small;">
</span><br />
<div style="font-family: inherit;">
<span style="font-size: small;">'Analytic Function' was an instant answer
whenever this question had been thrown at me. But the answer is
DENSE_RANK is both an Analytic and an aggregate function since Oracle
10G. </span></div>
<div style="font-family: inherit;">
<br /></div>
<div style="font-family: inherit;">
<span style="font-size: small;">DENSE_RANK as an aggregate function,</span>
</div>
<span style="font-family: inherit; font-size: small;">
</span><br />
<ul style="font-family: inherit;"><ul>
<li><span style="font-size: small;"> returns the dense rank of the hypothetical row identified by the arguments of the function in an order group of rows</span></li>
<span style="font-size: small;"><br /></span>
<li><span style="font-size: small;"> The arguments of the function must all
evaluate to constant expressions within each aggregate group, because
they identify a single row within each group</span></li>
<span style="font-size: small;"><br /></span>
<li><span style="font-size: small;"> the number of arguments must be the
same as number of expressions in the order_by_clause and types of the
arguments must also be compatible. </span></li>
<span style="font-size: small;"><br /></span></ul>
</ul>
<div style="font-family: inherit;">
<span style="font-size: small;">The following query returns dense rank of salary 2000 in each department,</span></div>
<div style="color: #0b5394; font-family: inherit;">
<br /></div>
<div style="color: #0b5394; font-family: inherit;">
</div>
<span style="font-family: inherit; font-size: small;"><b style="color: #0b5394;">
</b></span><br />
<div style="color: #0b5394; font-family: inherit;">
<span style="font-size: small;"><b> <span style="color: #351c75;">SELECT dept,</span></b><span style="color: #351c75;">
</span><b style="color: #351c75;"><br /> DENSE_RANK (2000) within group (order by salary DESC) DENSE_RNK</b><span style="color: #351c75;">
</span><b style="color: #351c75;"><br /> FROM employees</b><span style="color: #351c75;">
</span><b style="color: #351c75;"><br /> GROUP BY dept;</b></span></div>
<div style="font-family: inherit;">
<br /></div>
<div style="font-family: inherit;">
<span style="font-size: small;"> </span>
</div>
<span style="font-family: inherit; font-size: small;">
</span><br />
<div style="font-family: inherit;">
<span style="font-size: small;">Notably, the dense_rank will be identified and returned even if such salary does not exist in the department.</span>
</div>
<span style="font-family: inherit; font-size: small;">
</span><br />
<div style="font-family: inherit;">
<span style="font-size: small;">For instance when the above query runs
against employees table with below set of records dense_rank of salary
2000 in dept 4 will be returned as 4 even though there are no employees
earning the salary of 2000</span></div>
<span style="font-size: small;">
</span><br />
<div class="MsoNormal" style="line-height: normal;">
<br /></div>
<b><span style="font-size: small;">
</span></b><br />
<table border="0" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="border-collapse: collapse; margin-left: 4.65pt; width: 321px;">
<tbody>
<tr style="height: 15pt;">
<td nowrap="nowrap" style="background: none repeat scroll 0% 0% rgb(0, 176, 240); border: 1pt solid windowtext; font-family: Arial,Helvetica,sans-serif; height: 15pt; padding: 0cm 5.4pt; width: 87pt;" width="116"><div align="center" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: center;">
<b><span style="font-size: small;"><span style="color: black;">EMPLOYEE_ID </span></span></b></div>
</td>
<td nowrap="nowrap" style="-moz-border-bottom-colors: none; -moz-border-image: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; background: none repeat scroll 0% 0% rgb(0, 176, 240); border-color: windowtext windowtext windowtext -moz-use-text-color; border-style: solid solid solid none; border-width: 1pt 1pt 1pt medium; font-family: Arial,Helvetica,sans-serif; height: 15pt; padding: 0cm 5.4pt; width: 77pt;" valign="bottom" width="103"><div align="center" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: center;">
<b><span style="font-size: small;"><span style="color: black;">LAST_NAME </span></span></b></div>
</td>
<td nowrap="nowrap" style="-moz-border-bottom-colors: none; -moz-border-image: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; background: none repeat scroll 0% 0% rgb(0, 176, 240); border-color: windowtext windowtext windowtext -moz-use-text-color; border-style: solid solid solid none; border-width: 1pt 1pt 1pt medium; font-family: Arial,Helvetica,sans-serif; height: 15pt; padding: 0cm 5.4pt; width: 48pt;" valign="bottom" width="64"><div align="center" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: center;">
<b><span style="font-size: small;"><span style="color: black;">SALARY </span></span></b></div>
</td>
<td nowrap="nowrap" style="-moz-border-bottom-colors: none; -moz-border-image: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; background: none repeat scroll 0% 0% rgb(0, 176, 240); border-color: windowtext windowtext windowtext -moz-use-text-color; border-style: solid solid solid none; border-width: 1pt 1pt 1pt medium; font-family: Arial,Helvetica,sans-serif; height: 15pt; padding: 0cm 5.4pt; width: 29pt;" valign="bottom" width="39"><div align="center" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: center;">
<b><span style="font-size: small;"><span style="color: black;">DEPT</span></span></b></div>
</td>
</tr>
<tr style="height: 15pt;">
<td nowrap="nowrap" style="-moz-border-bottom-colors: none; -moz-border-image: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; border-color: -moz-use-text-color windowtext windowtext; border-right: 1pt solid windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; height: 15pt; padding: 0cm 5.4pt; width: 87pt;" width="116"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black; font-family: "Arial","sans-serif";">100 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 77pt;" valign="bottom" width="103"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">Employee100 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 48pt;" valign="bottom" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">1000 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 29pt;" valign="bottom" width="39"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: right;">
<span style="font-size: small;"><span style="color: black;">10</span></span></div>
</td>
</tr>
<tr style="height: 15pt;">
<td nowrap="nowrap" style="-moz-border-bottom-colors: none; -moz-border-image: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; border-color: -moz-use-text-color windowtext windowtext; border-right: 1pt solid windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; height: 15pt; padding: 0cm 5.4pt; width: 87pt;" width="116"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black; font-family: "Arial","sans-serif";">101 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 77pt;" valign="bottom" width="103"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">Employee101 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 48pt;" valign="bottom" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">2000 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 29pt;" valign="bottom" width="39"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: right;">
<span style="font-size: small;"><span style="color: black;">10</span></span></div>
</td>
</tr>
<tr style="height: 15pt;">
<td nowrap="nowrap" style="-moz-border-bottom-colors: none; -moz-border-image: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; border-color: -moz-use-text-color windowtext windowtext; border-right: 1pt solid windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; height: 15pt; padding: 0cm 5.4pt; width: 87pt;" width="116"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black; font-family: "Arial","sans-serif";">104 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 77pt;" valign="bottom" width="103"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">Employee104 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 48pt;" valign="bottom" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">2000 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 29pt;" valign="bottom" width="39"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: right;">
<span style="font-size: small;"><span style="color: black;">10</span></span></div>
</td>
</tr>
<tr style="height: 15pt;">
<td nowrap="nowrap" style="-moz-border-bottom-colors: none; -moz-border-image: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; border-color: -moz-use-text-color windowtext windowtext; border-right: 1pt solid windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; height: 15pt; padding: 0cm 5.4pt; width: 87pt;" width="116"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black; font-family: "Arial","sans-serif";">105 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 77pt;" valign="bottom" width="103"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">Employee105 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 48pt;" valign="bottom" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">4000 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 29pt;" valign="bottom" width="39"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: right;">
<span style="font-size: small;"><span style="color: black;">10</span></span></div>
</td>
</tr>
<tr style="height: 15pt;">
<td nowrap="nowrap" style="-moz-border-bottom-colors: none; -moz-border-image: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; border-color: -moz-use-text-color windowtext windowtext; border-right: 1pt solid windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; height: 15pt; padding: 0cm 5.4pt; width: 87pt;" width="116"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black; font-family: "Arial","sans-serif";">110 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 77pt;" valign="bottom" width="103"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">Employee110 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 48pt;" valign="bottom" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">4000 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 29pt;" valign="bottom" width="39"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: right;">
<span style="font-size: small;"><span style="color: black;">40</span></span></div>
</td>
</tr>
<tr style="height: 15pt;">
<td nowrap="nowrap" style="-moz-border-bottom-colors: none; -moz-border-image: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; border-color: -moz-use-text-color windowtext windowtext; border-right: 1pt solid windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; height: 15pt; padding: 0cm 5.4pt; width: 87pt;" width="116"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black; font-family: "Arial","sans-serif";">111 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 77pt;" valign="bottom" width="103"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">Employee111 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 48pt;" valign="bottom" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">8000 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 29pt;" valign="bottom" width="39"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: right;">
<span style="font-size: small;"><span style="color: black;">40</span></span></div>
</td>
</tr>
<tr style="height: 15pt;">
<td nowrap="nowrap" style="-moz-border-bottom-colors: none; -moz-border-image: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; border-color: -moz-use-text-color windowtext windowtext; border-right: 1pt solid windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; height: 15pt; padding: 0cm 5.4pt; width: 87pt;" width="116"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black; font-family: "Arial","sans-serif";">114 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 77pt;" valign="bottom" width="103"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">Employee114 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 48pt;" valign="bottom" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">8000 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 29pt;" valign="bottom" width="39"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: right;">
<span style="font-size: small;"><span style="color: black;">40</span></span></div>
</td>
</tr>
<tr style="height: 15.75pt;">
<td nowrap="nowrap" style="-moz-border-bottom-colors: none; -moz-border-image: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; border-color: -moz-use-text-color windowtext windowtext; border-right: 1pt solid windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; height: 15.75pt; padding: 0cm 5.4pt; width: 87pt;" width="116"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black; font-family: "Arial","sans-serif";">115 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15.75pt; padding: 0cm 5.4pt; width: 77pt;" valign="bottom" width="103"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">Employee115 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15.75pt; padding: 0cm 5.4pt; width: 48pt;" valign="bottom" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black;">16000 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15.75pt; padding: 0cm 5.4pt; width: 29pt;" valign="bottom" width="39"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: right;">
<span style="font-size: small;"><span style="color: black;">40</span></span></div>
</td>
</tr>
</tbody></table>
<span style="font-size: small;">
</span><br />
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<span style="font-size: small;">
</span>
<br />
<div style="font-family: inherit;">
<span style="font-size: small;">The above query will return, </span></div>
<span style="font-family: Arial; font-size: small;"> </span>
<br />
<span style="font-size: small;">
</span><br />
<table border="0" cellpadding="0" cellspacing="0" style="width: 133px;"><colgroup><col style="width: 40pt;" width="53"></col>
<col style="width: 60pt;" width="80"></col>
</colgroup><tbody>
<tr height="20" style="height: 15pt;">
<td class="xl67" height="20" style="height: 15pt; width: 40pt;" width="53"><div class="MsoNormal" style="line-height: normal;">
<br /></div>
<table border="0" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="border-collapse: collapse; margin-left: 4.65pt; width: 133px;">
<tbody>
<tr style="height: 15pt;">
<td nowrap="nowrap" style="background: none repeat scroll 0% 0% rgb(0, 176, 240); border: 1pt solid windowtext; height: 15pt; padding: 0cm 5.4pt; width: 40pt;" width="53"><div align="center" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: center;">
<span style="font-size: small;"><b><span style="color: black; font-family: "Arial","sans-serif";">DEPT </span></b></span></div>
</td>
<td nowrap="nowrap" style="-moz-border-bottom-colors: none; -moz-border-image: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; background: none repeat scroll 0% 0% rgb(0, 176, 240); border-color: windowtext windowtext windowtext -moz-use-text-color; border-style: solid solid solid none; border-width: 1pt 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 60pt;" width="80"><div align="center" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: center;">
<span style="font-size: small;"><b><span style="color: black;">DENSE_RNK</span></b></span></div>
</td>
</tr>
<tr style="height: 15pt;">
<td nowrap="nowrap" style="-moz-border-bottom-colors: none; -moz-border-image: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; border-color: -moz-use-text-color windowtext windowtext; border-right: 1pt solid windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; height: 15pt; padding: 0cm 5.4pt; width: 40pt;" valign="bottom" width="53"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black; font-family: "Arial","sans-serif";">10 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15pt; padding: 0cm 5.4pt; width: 60pt;" valign="bottom" width="80"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: right;">
<span style="font-size: small;"><span style="color: black;">2</span></span></div>
</td>
</tr>
<tr style="height: 15.75pt;">
<td nowrap="nowrap" style="-moz-border-bottom-colors: none; -moz-border-image: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; border-color: -moz-use-text-color windowtext windowtext; border-right: 1pt solid windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; height: 15.75pt; padding: 0cm 5.4pt; width: 40pt;" valign="bottom" width="53"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="color: black; font-family: "Arial","sans-serif";">40 </span></span></div>
</td>
<td nowrap="nowrap" style="border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; height: 15.75pt; padding: 0cm 5.4pt; width: 60pt;" valign="bottom" width="80"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; text-align: right;">
<span style="font-size: small;"><span style="color: black;">4</span></span></div>
</td>
</tr>
</tbody></table>
</td>
<td class="xl68" style="border-left: medium none; width: 60pt;" width="80"><span style="font-size: small;"><br /></span></td>
</tr>
<tr height="20" style="height: 15pt;">
<td class="xl69" height="20" style="border-top: medium none; height: 15pt;"><span style="font-size: small;"><br /></span></td><td class="xl69" height="20" style="border-top: medium none; height: 15pt;"><span style="font-size: small;"><br /></span></td>
<td align="right" class="xl65" style="border-left: medium none; border-top: medium none;"><span style="font-size: small;"><br /></span></td>
</tr>
<tr height="21" style="height: 15.75pt;">
<td class="xl70" height="21" style="border-top: medium none; height: 15.75pt;"><span style="font-size: small;"><br /></span></td>
<td align="right" class="xl66" style="border-left: medium none; border-top: medium none;"><span style="font-size: small;"><br /></span></td>
</tr>
</tbody></table>
<span style="font-family: Arial; font-size: small;"></span><span style="font-size: small;">
</span></div>Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-40194970383547858972012-03-03T01:52:00.000+05:302012-03-03T01:52:51.333+05:30Understanding ADD_MONTHS function<div dir="ltr" style="text-align: left;" trbidi="on"><div style="color: black;">Do you know everything about ADD_FUNCTION in oracle? Let us have a reality check. Have a look at the below query and predict the output, </div><div style="color: black;"><br />
</div><div style="color: #351c75; text-align: left;"><b>SELECT ADD_MONTHS('31-JAN-2012',1),</b></div><div style="color: #351c75; text-align: left;"><b> ADD_MONTHS('30-JAN-2012',1), </b></div><div style="color: #351c75; text-align: left;"><b> ADD_MONTHS('30-MAR-2012',1),</b></div><div style="color: #351c75; text-align: left;"><b> ADD_MONTHS('30-APR-2012',-1) ,</b></div><div style="color: #351c75; text-align: left;"><b> ADD_MONTHS('29-FEB-2012',1)</b></div><div style="text-align: left;"><b><span style="color: #351c75;"> FROM DUAL;</span></b></div><br />
Execute the above query and match your predictions with actual results. If you have got everything correct then I suggest not to waste your time by reading further ;). If you have not got everything right then its fair to say that you need to understand ADD_MONTHS function better.<br />
<br />
My suggestion to those who think there must be something wrong with ADD_MONTHS function is that read the below extract from oracle manual about ADD_MONTHS function,<br />
<br />
"<code>ADD_MONTHS</code> returns the date <em><code>d</code></em> plus <em><code>n</code></em> months. The argument <em><code>n</code></em> can be any integer. If <em><code>d</code></em> is the last day of the month or if the resulting month has fewer days than the day component of <em><code>d</code></em>, then the result is the last day of the resulting month. Otherwise, the result has the same day component as <em><code>d</code></em>."<br />
<br />
The above statement clearly defines two boundary conditions. They are<br />
<br />
1. If input date d is the last day of the month then ADD_MONTHS function will always return last day of the resulting month.<br />
For instance, ADD_MONTHS('29-FEB-2012',1) will return '31-Mar-2012' rather than '29-Mar-2012'<br />
<br />
2. If the resultant month has fewer days than input day then the result will be last day of the month<br />
For instance ADD_MONTHS('30-JAN-2012',1) will return '29-Feb-2012'<br />
<br />
The above two are very fair boundary conditions in order to ensure that ADD_MONTHS works fine for all dates with out any issue. <br />
<br />
Every one will be happy with this behavior until you have a requirement to shift months (add or subtract) with out changing the date like below,<br />
<br />
fn('30-Nov-2012',1) = '30-Dec-2012' <br />
<br />
Unfortunately ADD_MONTHS does not support this. But there is a work around. This can be achieved by using Interval arithmetic. Unlike ADD_MONTHS function INTERVAL '1' MONTH just shifts the month from November to December but keep the date as 30th.<br />
<br />
<div style="color: #351c75;"><b> SELECT DATE '30-NOV-2012' + INTERVAL '1' MONTH </b></div><b><span style="color: #351c75;"> FROM DUAL;</span></b><br />
<br />
But this solution comes in with a pitfall. The interval arithmetic will fail with invalid date exception when the resultant months has fewer days than you input date. For instance the below query will fail since the month of February does not have 30 days. <br />
<br />
<div style="color: #351c75;"><b>SELECT DATE '30-NOV-2012' + INTERVAL '3' MONTH </b></div><div style="color: #351c75;"><b> FROM DUAL;</b></div><br />
</div>Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-81984302658790274632012-03-03T00:30:00.003+05:302012-03-03T00:32:49.487+05:30Better late than never::TNSTC online booking is enabled!!<div dir="ltr" style="text-align: left;" trbidi="on"><div style="color: black;"><span style="font-family: Arial; font-size: large;">A good news for frequent travelers. Tamil Nadu Government has enabled Online Booking for Government buses. Here is the <a href="http://tnstc.ticketcounters.in/TNSTCOnline/">link</a> for online booking. </span></div><span style="color: blue; font-family: Arial; font-size: x-small;"><br />
</span><br />
<span style="color: blue; font-family: Arial; font-size: x-small;"><br />
</span></div>Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-30816462408976101372011-09-20T23:50:00.000+05:302011-09-20T23:50:43.221+05:30Sum of the Digits<div dir="ltr" style="text-align: left;" trbidi="on"><div style="text-align: left;">A simple puzzle to share with today...<br />
<br />
Write a program to find sum of all integers of a given number such that sum is always a single digit.<br />
For instance if the given number is 6789, then answer should be 6+7+8+9 = 30 and then 3+0 =3.<br />
<br />
A straight forward logic is to write a recursive function which calculates sum of digits until the it is less than 10. But there an efficient logic than this. Here is that<br />
<br />
1. Calculate mod(input_integer,9)<br />
2. if the result is 0 then <br />
sum of digits reduced to single digit is 9<br />
else<br />
value returned in step 1 is the sum of digits of input integer reduced to 9.</div><div style="text-align: left;"><br />
</div><div style="text-align: left;"></div><div style="text-align: left;"></div><div style="text-align: left;"></div><div style="text-align: left;"></div><div style="text-align: left;">Here is my oracle SQL solution,<br />
<b><br />
SELECT DECODE(MOD(INPUT_INTEGER,9),0,9,MOD(INPUT_INTEGER,9))</b></div><div style="text-align: left;"><b> FROM DUAL; </b> </div></div>Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-7730255829744151662011-09-14T23:01:00.002+05:302011-09-14T23:14:22.830+05:30Is 100!/(50! x 2^50) an integer?<div dir="ltr" style="text-align: left;" trbidi="on"><div class="MsoNormal"><br />
</div><div class="MsoNormal">I just read this puzzle somewhere and realized that this is similar to my earlier post <a href="http://sql-puzzles.blogspot.com/2011/08/how-many-zeros-does-1000-end-with.html">How many zeros does 1000! end with?</a></div><div class="MsoNormal"><br />
</div><div class="MsoNormal">Here is the solution to this puzzle,</div><div class="MsoNormal"><br />
</div><div class="MsoNormal">There is no doubt that 100!/50! is an integer. Hence we just need to find whether 100 x 99 x 98 x ... x 51 will be divisible by 2^50 or not. The mathematical theorem discussed in my earlier post helps us to solve this puzzle as well</div><div class="MsoNormal">let us find the exponents of 2 in 100!</div><div class="MsoNormal" style="text-align: left;"> [100/2] + [100/2^2 ] + [100/2^3 ] + [100/2^4 ] + [100/2^5 ] + [100/2^6 ] </div><div class="MsoNormal" style="text-align: left;"> = 50 + 25 + 12 + 6 +3+1 = 97</div><div class="MsoNormal">Therefore 100! is multiples of 2^97</div><div class="MsoNormal">let us find the exponents of 2 in 50!</div><div class="MsoNormal" style="text-align: left;"> [50/2] + [50/2^2 ] + [50/2^3 ] + [50/2^4 ] + [50/2^5 ]</div><div class="MsoNormal" style="text-align: left;"> = 25 + 12 + 6 +3+1 = 47</div><div class="MsoNormal">Therefore 50! is multiples of 2^47</div><div class="MsoNormal"><br />
</div><div class="MsoNormal">From the above it is evident that 100! / 50! is multiples of 2^50. Hence 100!/(50! x 2^50) is an integer</div></div>Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-74679787895703670002011-08-29T22:06:00.003+05:302011-09-01T02:03:53.321+05:30Project Euler: What is the sum of both diagonals in a 1001 by 1001 spiral?<div dir="ltr" style="text-align: left;" trbidi="on">Problem#28: What is the sum of both diagonals in a 1001 by 1001 spiral?<br />
<br />
Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:<br />
<br />
<div style="text-align: left;"><span style="font-family: "Courier New",Courier,monospace;"><b><span style="color: red;">21</span></b> 22 23 24 <b style="color: red;">25</b></span></div><div style="text-align: left;"><span style="font-family: "Courier New",Courier,monospace;">20 <b style="color: red;">7</b> 8<b style="color: red;"> 9</b> 10</span></div><div style="text-align: left;"><span style="font-family: "Courier New",Courier,monospace;">19 6 <b><span style="color: red;">1</span></b> 2 11</span></div><div style="text-align: left;"><span style="font-family: "Courier New",Courier,monospace;">18 <b style="color: red;">5</b> 4 <b style="color: red;">3</b> 12</span></div><div style="text-align: left;"><span style="font-family: "Courier New",Courier,monospace;"><b style="color: red;">17</b> 16 15 14 <b><span style="color: red;">13</span></b></span></div><br />
It can be verified that the sum of the numbers on the diagonals is 101. What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way?<br />
<br />
Solution:<br />
<br />
Number present in the diagonals of first spiral is 1<br />
Numbers present in the diagonals of second spiral is 3,5,7 and 9<br />
Numbers present in the diagonals of third spiral is 13,17,21 and 25<br />
Numbers present in the diagonals of Fourth spiral is 31,37,43 and 49<br />
<br />
From above observation it is easy to conculde the following,<br />
<br />
1. Every spiral has 4 diagonal numbers (except the first 1)<br />
2. Diagonal numbers same spirals are arithmetic sequences<br />
3,5,7 and 9 with 2 as common difference<br />
13,17,21 and 25 as 4 as common difference<br />
3. The value common difference in spiral s is 2(s-1)<br />
Ex: common diff of spiral 3 is 6 and spiral 4 is 8<br />
4. The difference between last number of spiral s-1 and first number of spiral s is also 2(s-1).<br />
Ex: diff between last number and first number of spiral 2 and 3 respectively is 4 ( 13 -9)<br />
diff between last number and first number of spiral 3 and 4 respectively is 6 ( 31 -25)<br />
5. Number of spirals in NxN matrix is N/2 + 1/2. <br />
<br />
The following PL/SQL solution is written based on the above findings,<br />
<br />
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background: none repeat scroll 0% 0% gray; border-collapse: collapse; border: medium none;"><tbody>
<tr> <td style="border: 1pt solid windowtext; padding: 0cm 5.4pt; width: 462.1pt;" valign="top" width="616"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;"><b><span style="color: #002060;">DECLARE<br />
</span> lv_final_value <span style="color: #002060;">NUMBER (10)</span>;<br />
lv_iter_value <span style="color: #002060;">NUMBER</span>;<br />
lv_factor <span style="color: #002060;">NUMBER</span>;<br />
<span style="color: #002060;">BEGIN</span><br />
lv_final_value := 1;<br />
lv_iter_value := 1;<br />
<br />
<span style="color: #002060;">FOR</span> i<span style="color: #002060;"> IN </span>2 .. 501<br />
<span style="color: #002060;">LOOP</span><br />
lv_factor := 2 * (i - 1);<br />
lv_final_value := lv_final_value +lv_iter_value * 4 + lv_factor * 10;<br />
lv_iter_value := lv_iter_value + lv_factor * 4;<br />
<span style="color: #002060;"> END LOOP</span>;<br />
<br />
<span style="color: #002060;">DBMS_OUTPUT.PUT_LINE</span> (lv_final_value);<br />
<span style="color: #002060;">END</span>;</b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;"><br />
</div></td> </tr>
</tbody></table><br />
<br />
Answer: 669171001 </div>Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-45363940395169648522011-08-02T22:59:00.000+05:302011-08-02T22:59:10.717+05:30How many zeros does 1000! end with?<div dir="ltr" style="text-align: left;" trbidi="on">Is it easy to find the number of zeros 1000! ends with? The answer is YES, it is very straight forward and the answer is 249. <br />
[For the people who does not understand n!(n Factorial).<br />
1000! is called '1000 factorial' which is equivalent to 1 x 2 x 3 ...x1000.<br />
<br />
The answer is [1000/5] + [1000/5^2 ] + [1000/5^3 ] + [1000/5^4 ]... <br />
= [1000/5] + [1000/25] +[1000/125] + [1000/625]<br />
= 200 + 40 + 8 +1 = 249<br />
( [n/p] stands for integer part of n/p. For instance [3/2 ] is 1 and [5/6] is 0. in computer terms FLOOR) <br />
<br />
Rest of this post is only for the people who wants to know little more about the mathematical theorem stands behind this solution<br />
<i><b><br />
Theorem:<br />
if N is an integer, P is a prime number and N! = p^s . m then s = [ n/p]v+ [n/p^3] + [n/p^4]...</b></i><br />
<br />
in our case N = 1000 and s is the solution we are looking for.What is the value for P? 10? but the theorem says P must be a prime number and 10 is not prime. But you know what 10 = 2 X 5 also 2 and 5 are prime numbers.<br />
So instead of finding exponents of 10 in 1000!, we can find exponent values of 2 and 5 in 1000! and minimum value will be exponent value of 10 in 1000!<br />
In other words, if we can find the exponent value of 5 in 1000! we can happily say that many number of zeros will be at the end of 1000!. </div>Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-17436473586131395932011-07-29T17:19:00.000+05:302011-07-29T17:39:55.682+05:30Project Euler – Problem1<!--[if gte mso 9]><xml> <o:officedocumentsettings> <o:allowpng/> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:worddocument> <w:view>Normal</w:View> <w:zoom>0</w:Zoom> <w:trackmoves/> <w:trackformatting/> <w:punctuationkerning/> <w:validateagainstschemas/> <w:saveifxmlinvalid>false</w:SaveIfXMLInvalid> <w:ignoremixedcontent>false</w:IgnoreMixedContent> <w:alwaysshowplaceholdertext>false</w:AlwaysShowPlaceholderText> <w:donotpromoteqf/> <w:lidthemeother>EN-IN</w:LidThemeOther> <w:lidthemeasian>X-NONE</w:LidThemeAsian> <w:lidthemecomplexscript>X-NONE</w:LidThemeComplexScript> <w:compatibility> <w:breakwrappedtables/> <w:snaptogridincell/> <w:wraptextwithpunct/> <w:useasianbreakrules/> <w:dontgrowautofit/> <w:splitpgbreakandparamark/> <w:enableopentypekerning/> <w:dontflipmirrorindents/> <w:overridetablestylehps/> </w:Compatibility> <m:mathpr> <m:mathfont val="Cambria Math"> <m:brkbin val="before"> <m:brkbinsub val="--"> <m:smallfrac val="off"> <m:dispdef/> <m:lmargin val="0"> <m:rmargin val="0"> <m:defjc val="centerGroup"> <m:wrapindent val="1440"> <m:intlim val="subSup"> <m:narylim val="undOvr"> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"> <w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"> <w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"> <w:lsdexception locked="false" priority="39" name="toc 1"> <w:lsdexception locked="false" priority="39" name="toc 2"> <w:lsdexception locked="false" priority="39" name="toc 3"> <w:lsdexception locked="false" priority="39" name="toc 4"> <w:lsdexception locked="false" priority="39" name="toc 5"> <w:lsdexception locked="false" priority="39" name="toc 6"> <w:lsdexception locked="false" priority="39" name="toc 7"> <w:lsdexception locked="false" priority="39" name="toc 8"> <w:lsdexception locked="false" priority="39" name="toc 9"> <w:lsdexception locked="false" priority="35" qformat="true" name="caption"> <w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"> <w:lsdexception locked="false" priority="1" name="Default Paragraph Font"> <w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"> <w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"> <w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"> <w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"> <w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"> <w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"> <w:lsdexception locked="false" unhidewhenused="false" name="Revision"> <w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"> <w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"> <w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"> <w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"> <w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"> <w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"> <w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"> <w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"> <w:lsdexception locked="false" priority="37" name="Bibliography"> <w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} </style> <![endif]--> <p>Problem:</p> <p>If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.Find the sum of all the multiples of 3 or 5 below 1000.</p> <p class="MsoNormal">Here is a straight forward solution to this problem,</p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; color: rgb(0, 0, 153);"><span style="">SELECT SUM(DECODE(MOD(ROWNUM,3),0,ROWNUM,</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; color: rgb(0, 0, 153);"><span style=""><span style=""> </span>DECODE(MOD(ROWNUM,5,0,ROWNUM,0)))</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; color: rgb(0, 0, 153);"><span style=""><span style=""> </span>FROM DUAL</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; color: rgb(0, 0, 153);"><span style="">CONNECT BY LEVEL <1000;</span></p> <p class="MsoNormal"><b> </b></p> <p class="MsoNormal"><span style="">The logic is simple. The CONNECT BY clause in the above statement simply acts as row generator to generate natural numbers from 1 to 999. <span style=""> </span><span style=""> </span></span></p> <p class="MsoNormal"><span style="">The DECODEs inside the aggregate function check whether the number is divisible either by 3 or 5 if so the number is added.</span></p> <p class="MsoNormal"><span style="">This is a simple solution to understand but certainly not the best when it comes to performance. <span style=""> </span>With the help of mathematical formula this problem can be solved little easier.</span></p> <p class="MsoNormal"><span style="">Multiples of 3 are 3, 6,9,12 … 999.<span style=""> </span>Sum of them is </span></p> <p class="MsoNormal"><span style="">3+6+9+…999 = 3 ( 1+2 + … + [999/3]) <span style=""> </span>( [999/3] denotes integer part of 999/3 )<span style=""> </span></span></p> <p class="MsoNormal"><span style=""><span style=""> </span>= 3 ([999/3]) ([999/3]+1)/2<span style=""> </span>( 1 + 2+ … + n = n(n+1)/2)</span></p> <p class="MsoNormal"><span style="">Sum of multiples of 5 is</span></p> <p class="MsoNormal">5 + 10 +15 +…[999/5] = 5<span style="">([999/5]) ([999/5]+1)/2</span></p> <p class="MsoNormal"><span style="">The tricky part is the numbers 15, 30 …990 are included in both the case. This series should be subtracted once from the solution. So the final solution is</span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; color: rgb(0, 0, 153);"><span style="">select trunc(999/3)* (trunc(999/3)+1) *3/2 </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; color: rgb(0, 0, 153);"><span style=""><span style=""> </span>+ trunc(999/5)* (trunc(999/5)+1) *5/2 </span></p> <p class="MsoNormal" style="margin-bottom: 0.0001pt; color: rgb(0, 0, 153);"><span style=""><span style=""> </span>- trunc(999/15)* (trunc(999/15)+1) *15/2 from dual;</span></p> <p class="MsoNormal"><span style=""> </span></p> <p class="MsoNormal">Answer: <b>233168</b></p> <p class="MsoNormal"> </p>Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-83417775888511153212011-07-27T22:02:00.000+05:302011-07-28T17:36:30.119+05:30SQL query to get last and second last payments to employees<!--[if gte mso 9]><xml> <o:officedocumentsettings> <o:allowpng/> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:worddocument> <w:view>Normal</w:View> <w:zoom>0</w:Zoom> <w:trackmoves/> <w:trackformatting/> <w:punctuationkerning/> <w:validateagainstschemas/> <w:saveifxmlinvalid>false</w:SaveIfXMLInvalid> <w:ignoremixedcontent>false</w:IgnoreMixedContent> <w:alwaysshowplaceholdertext>false</w:AlwaysShowPlaceholderText> <w:donotpromoteqf/> <w:lidthemeother>EN-IN</w:LidThemeOther> <w:lidthemeasian>X-NONE</w:LidThemeAsian> <w:lidthemecomplexscript>X-NONE</w:LidThemeComplexScript> <w:compatibility> <w:breakwrappedtables/> <w:snaptogridincell/> <w:wraptextwithpunct/> <w:useasianbreakrules/> <w:dontgrowautofit/> <w:splitpgbreakandparamark/> <w:enableopentypekerning/> <w:dontflipmirrorindents/> <w:overridetablestylehps/> </w:Compatibility> <m:mathpr> <m:mathfont val="Cambria Math"> <m:brkbin val="before"> <m:brkbinsub val="--"> <m:smallfrac val="off"> <m:dispdef/> <m:lmargin val="0"> <m:rmargin val="0"> <m:defjc val="centerGroup"> <m:wrapindent val="1440"> <m:intlim val="subSup"> <m:narylim val="undOvr"> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"> <w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"> <w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"> <w:lsdexception locked="false" priority="39" name="toc 1"> <w:lsdexception locked="false" priority="39" name="toc 2"> <w:lsdexception locked="false" priority="39" name="toc 3"> <w:lsdexception locked="false" priority="39" name="toc 4"> <w:lsdexception locked="false" priority="39" name="toc 5"> <w:lsdexception locked="false" priority="39" name="toc 6"> <w:lsdexception locked="false" priority="39" name="toc 7"> <w:lsdexception locked="false" priority="39" name="toc 8"> <w:lsdexception locked="false" priority="39" name="toc 9"> <w:lsdexception locked="false" priority="35" qformat="true" name="caption"> <w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"> <w:lsdexception locked="false" priority="1" name="Default Paragraph Font"> <w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"> <w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"> <w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"> <w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"> <w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"> <w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"> <w:lsdexception locked="false" unhidewhenused="false" name="Revision"> <w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"> <w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"> <w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"> <w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"> <w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"> <w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"> <w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"> <w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"> <w:lsdexception locked="false" priority="37" name="Bibliography"> <w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} table.MsoTableGrid {mso-style-name:"Table Grid"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-priority:59; mso-style-unhide:no; border:solid windowtext 1.0pt; mso-border-alt:solid windowtext .5pt; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-border-insideh:.5pt solid windowtext; mso-border-insidev:.5pt solid windowtext; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} </style> <![endif]--> <p class="MsoNormal"><span style=";font-family:";font-size:100%;" > </span></p> <p class="MsoNormal"><span style="line-height: 115%;font-family:";font-size:100%;" >Joe Celko is an American relational database expert. He has participated on the <a href="http://en.wikipedia.org/wiki/ANSI" title="ANSI">ANSI</a> X3H2 Database Standards Committee, and helped write the <a href="http://en.wikipedia.org/wiki/Structured_Query_Language" title="Structured Query Language">SQL</a>-89 and SQL-92 standards.<span style=""> </span>The above lines would explain his innumerable contributions to RDBMS world. His “SQL Puzzles and Answers” is another golden feather on his cap. If you are an SQL geek and you’ve never been come across this book then please try this. I promise you will never be disappointed. Here is a puzzle from this book.</span></p> <p class="MsoNormal"><span style="line-height: 115%;font-family:";font-size:100%;" >Assume that there is salary table with three columns hold employee name, salary date and salary. This table holds salary information paid to employees. The requirement is to write a query that should return employee’s current and previous salary status for each employee.</span></p> <p class="MsoNormal"><span style="line-height: 115%;font-family:";font-size:100%;" >You can use the following statement and the pl/sql block to create and populate sample data to test the solutions.</span><span style="line-height: 115%;font-family:";font-size:100%;" ></span></p> <table class="MsoTableGrid" style="background: none repeat scroll 0% 0% rgb(148, 138, 84); border-collapse: collapse; border: medium none; width: 666px; height: 426px;" border="1" cellpadding="0" cellspacing="0"> <tbody><tr style=""> <td style="width: 462.1pt; border: 1pt solid windowtext; background: none repeat scroll 0% 0% rgb(166, 166, 166); padding: 0cm 5.4pt;" valign="top" width="616"> <p class="MsoNormal" style="line-height: normal; color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" >CREATE</span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" >TABLE</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp</span></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" >(</span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >NAME</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >VARCHAR2</span><span style=";font-family:";font-size:100%;" lang="EN-US" >(</span><span style=";font-family:";font-size:100%;" lang="EN-US" >50</span><span style=";font-family:";font-size:100%;" lang="EN-US" >),</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">sal_date</span></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >DATE</span><span style=";font-family:";font-size:100%;" lang="EN-US" >,</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">salary</span></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >NUMBER</span><span style=";font-family:";font-size:100%;" lang="EN-US" >(</span><span style=";font-family:";font-size:100%;" lang="EN-US" >15</span><span style=";font-family:";font-size:100%;" lang="EN-US" >,</span><span style=";font-family:";font-size:100%;" lang="EN-US" >2</span><span style=";font-family:";font-size:100%;" lang="EN-US" >))</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span></p> <p style="color: rgb(0, 0, 153);"><span style=";font-family:";font-size:100%;" lang="EN-US" >BEGIN</span><span style=";font-family:";font-size:100%;" ><br /> </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >FOR</span><span style=";font-family:";font-size:100%;" lang="EN-US" > i</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >IN</span><span style=";font-family:";font-size:100%;" lang="EN-US" > 1</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >..</span><span style=";font-family:";font-size:100%;" lang="EN-US" > 10</span><span style=";font-family:";font-size:100%;" ><br /> </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >LOOP</span><span style=";font-family:";font-size:100%;" ><br /> </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >INSERT</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >INTO</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp</span></span><span style=";font-family:";font-size:100%;" ><br /> </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >VALUES</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(</span><span style="color: rgb(255, 0, 0);font-family:";font-size:100%;" lang="EN-US" >'James'</span><span style=";font-family:";font-size:100%;" lang="EN-US" >,</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >ADD_MONTHS</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(TO_DATE(<span style="color: rgb(255, 0, 0);">‘01-01-2010’</span>,<span style="color: rgb(255, 0, 0);">’DD-MM-YYYY’</span>),</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >i</span><span style=";font-family:";font-size:100%;" lang="EN-US" >),</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">5000 * i</span></span><span style=";font-family:";font-size:100%;" lang="EN-US" >);</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span></p> <p style="color: rgb(0, 0, 153);"><span style=";font-family:";font-size:100%;" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >INSERT</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >INTO</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp</span></span><span style=";font-family:";font-size:100%;" ><br /> </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >VALUES</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(</span><span style="color: rgb(255, 0, 0);font-family:";font-size:100%;" lang="EN-US" >'Rajendran'</span><span style=";font-family:";font-size:100%;" lang="EN-US" >,</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >ADD_MONTHS</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(TO_DATE(<span style="color: rgb(255, 0, 0);">‘01-01-2010’</span>,<span style="color: rgb(255, 0, 0);">’DD-MM-YYYY’</span>),</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >i</span><span style=";font-family:";font-size:100%;" lang="EN-US" >),</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">5100 * i</span></span><span style=";font-family:";font-size:100%;" lang="EN-US" >);</span></p><span style=";font-family:";font-size:100%;" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" >INSERT</span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" >INTO</span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp</span></span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" ><br /> </span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" >VALUES</span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" >(</span><span style="color: rgb(255, 0, 0);font-family:";font-size:100%;" lang="EN-US" >'Krishna'</span><span style=";font-family:";font-size:100%;" lang="EN-US" >,</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" >ADD_MONTHS</span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" ><span style="color: rgb(0, 0, 153);">(TO_DATE</span>(<span style="color: rgb(255, 0, 0);">‘01-01-2010’</span>,<span style="color: rgb(255, 0, 0);">’DD-MM-YYYY’</span>),</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >i</span><span style=";font-family:";font-size:100%;" lang="EN-US" >),</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">5200 * i</span></span><span style=";font-family:";font-size:100%;" lang="EN-US" >);</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span> <p style="color: rgb(0, 0, 153);"><span style=";font-family:";font-size:100%;" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >INSERT</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >INTO</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp</span></span><span style=";font-family:";font-size:100%;" ><br /> </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >VALUES</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(</span><span style="color: rgb(255, 0, 0);font-family:";font-size:100%;" lang="EN-US" >'Jagdish'</span><span style=";font-family:";font-size:100%;" lang="EN-US" >,</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >ADD_MONTHS</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(TO_DATE(<span style="color: rgb(255, 0, 0);">‘01-01-2010’</span>,<span style="color: rgb(255, 0, 0);">’DD-MM-YYYY’</span>),</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >i</span><span style=";font-family:";font-size:100%;" lang="EN-US" >),</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">5300 * i</span></span><span style=";font-family:";font-size:100%;" lang="EN-US" >);</span></p><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" ><br /></span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;color:black;" lang="EN-US" > </span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;color:blue;" lang="EN-US" >END</span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;color:blue;" lang="EN-US" >LOOP;</span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" ><br /></span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;color:blue;" lang="EN-US" >END;</span><span style=";font-family:";font-size:100%;" ></span></p> </td> </tr> </tbody></table> <p class="MsoNormal"><span style="line-height: 115%;font-family:";font-size:100%;" > </span></p> <p class="MsoNormal"><span style="line-height: 115%;font-family:";font-size:100%;" >Here is my first solution to this problem,</span></p> <p><span style=";font-family:";font-size:100%;" ><span style=""> </span></span></p> <p class="MsoNormal" style="line-height: normal; background: none repeat scroll 0% 0% rgb(166, 166, 166); color: rgb(0, 0, 153);"><span style=";font-family:";font-size:100%;" lang="EN-US" >SELECT</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" ><span style="color: rgb(0, 0, 0);">NAME</span>,</span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(SELECT</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >SUM</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >salary</span><span style=";font-family:";font-size:100%;" lang="EN-US" >)</span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >FROM</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp emp_inner1</span></span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >WHERE</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp_inner1</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >sal_date</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >></span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp_outer</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >second_last</span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >AND</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp_inner1</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.NAME</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >=</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp_outer</span></span><span style=";font-family:";font-size:100%;" lang="EN-US" ><span style="color: rgb(0, 0, 0);">.NAME</span>)</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" > last_salary</span><span style=";font-family:";font-size:100%;" lang="EN-US" >,</span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(SELECT</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">salary</span></span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >FROM</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp e1</span></span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >WHERE</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">e1</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.NAME</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >=</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp_outer</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.NAME</span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >AND</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">e1</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >sal_date</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >=</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp_outer</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >second_last</span><span style=";font-family:";font-size:100%;" lang="EN-US" >)</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">second_last_salary</span></span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >FROM</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(SELECT</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" ><span style="color: rgb(0, 0, 0);">NAME</span>,</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >MAX</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >sal_date</span><span style=";font-family:";font-size:100%;" lang="EN-US" >)</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">second_last</span></span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >FROM</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" > emp emp1</span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >WHERE</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" > sal_date</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" ><</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(SELECT</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >MAX</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >sal_date</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >)</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" ><br /></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 153);font-family:";font-size:100%;" lang="EN-US" >FROM</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" > emp emp2</span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >WHERE</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp2</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.NAME</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >=</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp1</span></span><span style=";font-family:";font-size:100%;" lang="EN-US" ><span style="color: rgb(0, 0, 0);">.NAME</span>)</span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >GROUP</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >BY</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" ><span style="color: rgb(0, 0, 0);">NAME</span>)</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp_outer</span></span><span style=";font-family:";font-size:100%;" lang="EN-US" >;</span></p> <p class="MsoNormal" style="line-height: normal;"><span style=";font-family:";font-size:100%;" lang="EN-US" > </span></p> <p class="MsoNormal" style="line-height: normal;"><span style=";font-family:";font-size:100%;" lang="EN-US" >I think this is a little expensive query. The main query fetches the second last salary data for each employee. The sub queries in select clause find the last and second last salary by using second last salary date.</span></p> <p class="MsoNormal" style="line-height: normal;"><span style=";font-family:";font-size:100%;" lang="EN-US" >But the above query fails when there is a new employee who has got only one payment. The above query does not report the new employee at all. The following solution which looks better than the above also takes care of employees with only one payment.</span></p> <p class="MsoNormal" style="line-height: normal; background: none repeat scroll 0% 0% rgb(166, 166, 166); color: rgb(0, 0, 153);"><span style=";font-family:";font-size:100%;" lang="EN-US" >SELECT</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" ><span style="color: rgb(0, 0, 0);">NAME</span>,</span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(SELECT</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">salary</span></span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >FROM</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp emp_inner1</span></span><span style=";font-family:";font-size:100%;" ><br /></span> <span style=";font-family:";font-size:100%;" lang="EN-US" >WHERE</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp_inner1</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >sal_date</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >=</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" > emp_outer</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >latest</span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >AND</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp_inner1</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.NAME</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >=</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp_outer</span></span><span style=";font-family:";font-size:100%;" lang="EN-US" ><span style="color: rgb(0, 0, 0);">.NAME</span>)</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">latest</span></span><span style=";font-family:";font-size:100%;" lang="EN-US" >,</span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(SELECT</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">salary</span></span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >FROM</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp emp_inner2</span></span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >WHERE</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp_inner2</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >sal_date</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >=</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" > emp_outer</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >second_latest</span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >AND</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp_inner2</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.NAME</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >=</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" > emp_outer</span><span style=";font-family:";font-size:100%;" lang="EN-US" ><span style="color: rgb(0, 0, 0);">.NAME</span>)</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">second_latest</span></span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >FROM</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(SELECT</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">e1</span></span><span style=";font-family:";font-size:100%;" lang="EN-US" ><span style="color: rgb(0, 0, 0);">.NAME</span>,</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >MAX</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >e1</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >sal_date</span><span style=";font-family:";font-size:100%;" lang="EN-US" >)</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">latest</span></span><span style=";font-family:";font-size:100%;" lang="EN-US" >,</span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >MAX</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >(</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >e2</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >sal_date</span><span style=";font-family:";font-size:100%;" lang="EN-US" >)</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">second_latest</span></span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >FROM</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp e1</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >,</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" > emp e2</span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >WHERE</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">e1</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.NAME</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" > </span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >=</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" > e2</span><span style=";font-family:";font-size:100%;" lang="EN-US" ><span style="color: rgb(0, 0, 0);">.NAME</span>(+)</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >AND</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">e1</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >sal_date</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >></span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">e2</span></span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >.</span><span style="color: rgb(0, 0, 0);font-family:";font-size:100%;" lang="EN-US" >sal_date</span><span style=";font-family:";font-size:100%;" lang="EN-US" >(+)</span><span style=";font-family:";font-size:100%;" ><br /></span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >GROUP</span><span style=";font-family:";font-size:100%;" lang="EN-US" > </span><span style=";font-family:";font-size:100%;" lang="EN-US" >BY</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">e1</span></span><span style=";font-family:";font-size:100%;" lang="EN-US" ><span style="color: rgb(0, 0, 0);">.NAME</span>)</span><span style=";font-family:";font-size:100%;" lang="EN-US" > <span style="color: rgb(0, 0, 0);">emp_oute</span>r;</span></p> <p class="MsoNormal" style="line-height: normal;"><span style=";font-family:";font-size:100%;color:black;" lang="EN-US" >The main query fetches both last and second last payment date using self-outer join. This outer join makes sure that employees with only one payment are not missed out. I'm hoping that I will be updating this post with an even better query one day<br /></span></p><p class="MsoNormal" style="line-height: normal;"><span style="font-size:100%;"><br /></span></p> <p class="MsoNormal" style="line-height: normal;"><span style=";font-family:";font-size:100%;color:blue;" lang="EN-US" ><span style=""> </span></span><span style=";font-family:";font-size:100%;" ></span></p> <p class="MsoNormal"><span style=";font-family:";font-size:100%;" > </span></p>Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-12789658950808379262011-07-27T09:22:00.000+05:302011-07-27T09:30:51.699+05:30Project Euler - An Ideal place to enhance your analytical skills<!--[if gte mso 9]><xml> <o:officedocumentsettings> <o:allowpng/> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:worddocument> <w:view>Normal</w:View> <w:zoom>0</w:Zoom> <w:trackmoves/> <w:trackformatting/> <w:punctuationkerning/> <w:validateagainstschemas/> <w:saveifxmlinvalid>false</w:SaveIfXMLInvalid> <w:ignoremixedcontent>false</w:IgnoreMixedContent> <w:alwaysshowplaceholdertext>false</w:AlwaysShowPlaceholderText> <w:donotpromoteqf/> <w:lidthemeother>EN-IN</w:LidThemeOther> <w:lidthemeasian>X-NONE</w:LidThemeAsian> <w:lidthemecomplexscript>X-NONE</w:LidThemeComplexScript> <w:compatibility> <w:breakwrappedtables/> <w:snaptogridincell/> <w:wraptextwithpunct/> <w:useasianbreakrules/> <w:dontgrowautofit/> <w:splitpgbreakandparamark/> <w:enableopentypekerning/> <w:dontflipmirrorindents/> <w:overridetablestylehps/> </w:Compatibility> <m:mathpr> <m:mathfont val="Cambria Math"> <m:brkbin val="before"> <m:brkbinsub val="--"> <m:smallfrac val="off"> <m:dispdef/> <m:lmargin val="0"> <m:rmargin val="0"> <m:defjc val="centerGroup"> <m:wrapindent val="1440"> <m:intlim val="subSup"> <m:narylim val="undOvr"> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"> <w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"> <w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"> <w:lsdexception locked="false" priority="39" name="toc 1"> <w:lsdexception locked="false" priority="39" name="toc 2"> <w:lsdexception locked="false" priority="39" name="toc 3"> <w:lsdexception locked="false" priority="39" name="toc 4"> <w:lsdexception locked="false" priority="39" name="toc 5"> <w:lsdexception locked="false" priority="39" name="toc 6"> <w:lsdexception locked="false" priority="39" name="toc 7"> <w:lsdexception locked="false" priority="39" name="toc 8"> <w:lsdexception locked="false" priority="39" name="toc 9"> <w:lsdexception locked="false" priority="35" qformat="true" name="caption"> <w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"> <w:lsdexception locked="false" priority="1" name="Default Paragraph Font"> <w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"> <w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"> <w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"> <w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"> <w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"> <w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"> <w:lsdexception locked="false" unhidewhenused="false" name="Revision"> <w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"> <w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"> <w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"> <w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"> <w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"> <w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"> <w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"> <w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"> <w:lsdexception locked="false" priority="37" name="Bibliography"> <w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} </style> <![endif]--> <p class="MsoNormal">Think about this, you are in love with analytical problems and you are a software guy and you always feel comfortable when it comes to mathematics. One day you found a website where you have mathematical analytical puzzles and you are expected to solve them using your favorite software tool. Things cannot be better than this. Is in it? I just had the same feeling the moment I came to know the website “<a href="http://projecteuler.net/index.php?section=about">Project Euler</a>” through few “siragu muzhaitha paravaigal” (colleagues who put their papers) having quality time with this website </p> <p class="MsoNormal">This site completely swept my attention towards it from the moment I saw it. Being a mathematician by nature and software guy by profession, I could not restrict me from solving the puzzles despite a full packed busy schedule.</p> <p class="MsoNormal">The objective is simple. <a href="http://projecteuler.net/index.php?section=about">Project Euler</a> is a series of challenging mathematical problems. You need to solve them by using any of your favorite programming language in line with the "one-minute rule". This means, your algorithm implementation will allow a solution to be obtained on a modestly powered computer in less than one minute.</p> <p class="MsoNormal">The “Project Euler” also comes with usual ingredients such as country level ranking, discussion forums, tips to build best algorithm (of course it’s hidden until you post your solution) and many more.<span style=""> </span></p> <p class="MsoNormal">I have chosen interesting software which is not even in the list maintained by Euler Admin itself. Neither have I had any other choice as I know only s/w language since I started my career as IT professional. It is an interesting choice though…It is Oracle SQL and PL/SQL.</p> <p class="MsoNormal"><!--[if gte mso 9]><xml> <o:officedocumentsettings> <o:allowpng/> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:worddocument> <w:view>Normal</w:View> <w:zoom>0</w:Zoom> <w:trackmoves/> <w:trackformatting/> <w:punctuationkerning/> <w:validateagainstschemas/> <w:saveifxmlinvalid>false</w:SaveIfXMLInvalid> <w:ignoremixedcontent>false</w:IgnoreMixedContent> <w:alwaysshowplaceholdertext>false</w:AlwaysShowPlaceholderText> <w:donotpromoteqf/> <w:lidthemeother>EN-IN</w:LidThemeOther> <w:lidthemeasian>X-NONE</w:LidThemeAsian> <w:lidthemecomplexscript>X-NONE</w:LidThemeComplexScript> <w:compatibility> <w:breakwrappedtables/> <w:snaptogridincell/> <w:wraptextwithpunct/> <w:useasianbreakrules/> <w:dontgrowautofit/> <w:splitpgbreakandparamark/> <w:enableopentypekerning/> <w:dontflipmirrorindents/> <w:overridetablestylehps/> </w:Compatibility> <m:mathpr> <m:mathfont val="Cambria Math"> <m:brkbin val="before"> <m:brkbinsub val="--"> <m:smallfrac val="off"> <m:dispdef/> <m:lmargin val="0"> <m:rmargin val="0"> <m:defjc val="centerGroup"> <m:wrapindent val="1440"> <m:intlim val="subSup"> <m:narylim val="undOvr"> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"> <w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"> <w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"> <w:lsdexception locked="false" priority="39" name="toc 1"> <w:lsdexception locked="false" priority="39" name="toc 2"> <w:lsdexception locked="false" priority="39" name="toc 3"> <w:lsdexception locked="false" priority="39" name="toc 4"> <w:lsdexception locked="false" priority="39" name="toc 5"> <w:lsdexception locked="false" priority="39" name="toc 6"> <w:lsdexception locked="false" priority="39" name="toc 7"> <w:lsdexception locked="false" priority="39" name="toc 8"> <w:lsdexception locked="false" priority="39" name="toc 9"> <w:lsdexception locked="false" priority="35" qformat="true" name="caption"> <w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"> <w:lsdexception locked="false" priority="1" name="Default Paragraph Font"> <w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"> <w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"> <w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"> <w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"> <w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"> <w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"> <w:lsdexception locked="false" unhidewhenused="false" name="Revision"> <w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"> <w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"> <w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"> <w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"> <w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"> <w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"> <w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"> <w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"> <w:lsdexception locked="false" priority="37" name="Bibliography"> <w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} </style> <![endif]--> </p><p class="MsoNormal">People who want to know more before kick-start this just check this <a href="http://projecteuler.net/index.php?section=about">link</a>.</p> <p class="MsoNormal"> </p> <p class="MsoNormal"><br /></p> <p class="MsoNormal"> </p> <p class="MsoNormal"> </p>Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-65855707430136744302010-10-08T19:00:00.000+05:302010-10-08T20:57:14.383+05:30எந்திரன் - என் பார்வையில்...படத்தின் கதை ஒரு இருவரி கதை. ரஜினி ஒரு ரோபோ உருவாக்கும் scientist. அவர் தயாரித்த சூப்பர் எந்திரனான சிட்டி ஐஸ்வர்யா மீது கொண்ட காதலால் வில்லன் துணையுடன் நாச வேலைகளில் ஈடுபடுகிறது. அதை நாயகன் ரஜினி முறியடிக்கிறார். இவ்வளவு தான் கதை.<br /><br /><span>சந்தானம்</span> <span>மற்றும்</span> <span>கருணாசுக்கு</span> <span>ரொம்ப</span> <span>ஸ்கோப்</span> <span>இல்லாத</span> <span>படம்</span> <span>இது</span>. <span>சந்தானம்</span> <span>ஸ்பெசலான</span> <span>டபுள்</span> <span>மீனிங்</span> <span>ஜோக்</span> <span>ஒன்னே</span> <span>ஒண்ணுதான்</span> <span>இந்த</span> <span>படத்துல</span>. <span>அதையும்</span> <span>ரஜினி</span> <span>பயங்கரமா</span> <span>கண்டிக்கிறார்</span>. <span>இந்த</span> <span>கண்ணடிப்பு</span> <span>படத்தில்</span> <span>மட்டும்</span> <span>உண்மையிலும்</span> <span>தான்</span> <span>என்பது</span> <span>போல்</span>. <span>அதன்</span> <span>பின்</span> <span>சந்தானம்</span> <span>அடக்கி</span> <span>வாசிக்கிறார்</span>. <span>உண்மையை</span> <span>சொல்லப்போனால்</span> <span>ஜஸ்ட்</span> <span>வந்து</span> <span>போகிறார்</span>.<span> ரஜினிக்கு</span> <span>சந்திரமுகி</span> <span>தந்த</span> <span>படிப்பினையாக</span> <span>இருக்கலாம்</span>. <span><span></span></span> <span><span></span></span><br /><br />நல்லவேளை எந்திரன் படத்தில் கமல் நடிக்கவில்லை. ஒரு காட்சியில் ரஜினி ஐஸ்வர்யாவிடம் தான் எந்திரன் இல்லை என்பதை நிரூபிக்க கையை கிழித்து இரத்தத்தை காண்பிக்கிறார் ரஜினி. இதுவே கமலாக இருந்திருந்தால் எதை காண்பித்து நிருபித்திருப்பார்? ( அவ்வைஷண்முகி அனைவருக்கும் நியாபகம் இருக்கும்) ஐஸ்வர்யாவின் கதி அதோ கதிதான் ;-}<br /><br />படத்தின் முதல் பாடலில் ரஜினி ஐஸ்வர்யா இருவரின் வயதும் அப்பட்டமாய் தெரிகிறது. பாபா செகண்ட் பார்ட் போன்ற உணர்வு உண்டாகிறது. ஆனால் நல்லவேளையாக சுதாரித்துக்கொண்டார்கள் போலும் ஐஸ்வர்யாவின் வயது படிப்படியாய் குறைந்து வழக்கம் போல் தேவதையாக வலம்வருகிறார். ரஜினி? ( போங்க பாஸ் தலைட்ட நாம் இதையா எதிர்பார்க்கிறோம். தலை வயசானாலும் சிங்கம்ல).<br /><br />எந்திரன் வரும் நடன காட்சிகளில் ரஜினி சிவாஜியை போல் ஆடுகிறார். அதுவும் பார்பதற்கு ரோபோ ஆடுவது போல் தான் இருக்கிறது :) (சிவாஜியின் ரசிகர்கள் என்னை மன்னிப்பார்களாக).<br /><br /><span></span>படத்திற்கு பிளஸ் ஆன விஷயங்கள்<br /><br /><ul><li><span>எந்திரன்</span> <span>வில்லனாக</span> <span>வரும்</span> <span>காட்சிகள்</span>. <span>ரஜினி</span> <span>தனது</span> <span>பழைய</span> <span>வில்லத்தனத்தை</span><span>தூசு</span> <span>தட்டி</span> <span>காண்பிக்கிறார்</span>. <span>உண்மையிலேயே</span> <span>நீங்க</span> <span>சூப்பர்</span> <span>வில்லன்</span> <span>ரஜினி</span> <span>சார்</span>.</li><li><span>எந்திரன்</span> <span>செய்கிற</span> <span>ரொமான்ஸ்</span> <span>காட்சிகள்</span></li><li><span>எந்திரன்</span> <span>பிரசவம்</span> <span>பார்க்கும்</span> <span><span>காட்சி</span></span></li><li><span><span></span>குழந்தைகளை கவரும் கிராபிக்ஸ் காட்சிகள்</span></li><li><span>எந்திரன் கடைசியில் தரும் பஞ்ச் மெசேஜ் </span></li><li><span>பஞ்ச்</span> <span>டயலாக்</span> <span>சுத்தமாய்</span> <span>இல்லாமல்</span> <span>இருப்பது</span></li><li><span>நல்லவேளை</span> <span>ரஜினியின்</span> mentor <span>ஆக</span> <span>வரும்</span> <span>வில்லன்</span> <span>சுமாராக</span> <span>தமிழ்</span> <span>பேசுகிறார்</span>. <span>அவர்</span> <span>லுக்குக்கு</span> <span>சேட்டு</span> <span>தமிழ்</span> <span>தான்</span> <span>பேசுவார்னு</span> <span>வந்த</span> <span>பயம்</span> <span>நம்மை</span> <span>விட்டு</span><span>அகல்கிறது</span></li></ul><br />படத்திற்கு நெகடிவான விஷயங்கள்<br /><br /><ul><li><span>ரஜினியின்</span> <span>குரலில்</span> <span>தெரியும்</span> <span>அவரது</span> <span>வயது</span>. <span>ஒருசில</span> <span>பாடல்</span> <span>காட்சிகளிலும்</span><span>அவரின்</span> <span>முதுமை</span> <span>தெரிகிறது</span></li><li><span>கொஞ்சம்</span> <span>இழுக்கப்பட்ட</span> <span>கிளைமாக்ஸ்</span></li><li><span>ரஜினிக்கு</span> <span>கொஞ்சம்</span> <span>கூட</span> <span>சம்பந்தம்</span> <span>இல்லாத</span> <span>அம்மா</span> <span>அண்ட்</span> <span>அப்பா</span>. <span>மற்றும்</span><span>ஐஸ்வர்யா</span> <span>சொல்லும்</span> <span>ஹாப்பி</span> <span>ஹோம்</span> <span>கொஞ்சம்</span> <span>ஒத்துகொள்ள</span> <span>முடியவில்லை</span></li></ul> <span>இறுதியாக</span> <span>ஷங்கரின்</span> <span>ரசிகனாய்</span> <span>ஒரு</span> <span>உறுத்தல்</span>... <span>படத்தின்</span> <span>ஓரிரு</span> <span>காட்சிகளில்</span> <span>மட்டுமே</span> <span>ஷங்கர்</span> <span>தென்படுகிறார்</span>. <span>மற்றபடி</span> <span>படம்</span> <span>முழுவதும்</span> <span>ரஜினி</span> <span>ரஜினி</span> <span>ரஜினி</span> <span>தான்</span>. <span>என்னை</span> <span>பொறுத்தவரை</span> <span>ஷங்கர்</span> <span>ரஜினி</span> <span>போன்ற</span> <span>மாஸ்</span> <span>உள்ள</span> <span>ஹீரோக்களை</span> <span>வைத்து</span> <span>படம்</span> <span>பண்ணாம</span> <span>இருக்கலாம்</span>. <span>அவரோட</span> <span>தனித்துவம்</span> <span>போய்விடுகிறது</span>.<br /><br />மொத்தத்தில் இது சிறுவர்கள் விரும்பும் ரஜினி படம். மற்றவர்கள் கண்டிப்பாக ஒரு முறை ரசிக்கலாம். எதிர்பார்ப்பு இல்லாம பார்த்திங்கன்னா கண்டிப்பா என்ஜாய் பண்ணலாம்.Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-75521290891288538212010-09-29T22:54:00.000+05:302010-09-30T00:51:23.367+05:30Deleting Duplicate Records form oracle table"Write a SQL query to remove duplicate records from an Oracle table"<br /><br />This is one question which I have been asked to answer this question in almost all the interviews I attended so far. The answer used to come in a flash. I used to solve this by using ROWID in a sub query. I think most of us use the same logic. Perhaps some of us would use MAX(ROWID) and some of us would use MIN(ROWID).<br /><br />Recently I just had an opportunity to read the url <a href="http://www.dba-oracle.com/t_delete_duplicate_table_rows.htm">http://www.dba-oracle.com/t_delete_duplicate_table_rows.htm</a>. This guy has used different techniques to achieve the same. Real good stuff... So just check that out and enjoy :)Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-65413716077988425592010-03-04T12:28:00.000+05:302010-03-04T12:33:56.600+05:30Oracle Puzzle: How may O's ur sentense hasProblem Statement: Find how many times each character occurs in the given sentence. For Example if the given sentence is 'good morning' should return<br />g:2<br />o:3<br />d:1<br />'':1<br />m:1<br />r:1<br />n:2<br /><br />It is quite simple if you opt for a pl/sql procedure. The inbuilt functions length and replance are just enough. Here is the procedure I had written to solve this problem. May be you can come up with better solution. <br /><br /><span style="font-weight: bold; color: rgb(0, 0, 153); font-style: italic;">set serveroutput on</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153); font-style: italic;">declare</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153); font-style: italic;"> lv_string varchar2(500);</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153); font-style: italic;"> lv_length number(2);</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153); font-style: italic;">begin</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153); font-style: italic;"> lv_string := 'replace your input string here';</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153); font-style: italic;"> loop</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153); font-style: italic;"> lv_length := length(lv_string) - nvl(length (replace (lv_string, substr(lv_string,1,1))),0);</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153); font-style: italic;"> dbms_output.put_line ( substr(lv_string,1,1) || ': ' || to_char(lv_length));</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153); font-style: italic;"> lv_string := replace (lv_string, substr(lv_string,1,1));</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153); font-style: italic;"> exit when lv_string is null;</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153); font-style: italic;"> end loop;</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153); font-style: italic;">end;</span><br /><br />Can this be solved by a SQL statement? Yes. There is a way :-}<br />I have been wondering the power of ROWNUM many times. Indeed this is also a fine example. Here is my SQL solution to this problem,<br /><br /><span style="color: rgb(0, 0, 153); font-weight: bold; font-style: italic;">select lv_char, count(lv_char)</span><br /><span style="color: rgb(0, 0, 153); font-weight: bold; font-style: italic;"> from (select substr(lv_string,rownum,1) lv_char</span><br /><span style="color: rgb(0, 0, 153); font-weight: bold; font-style: italic;"> from (select 'replace your input string here' lv_string </span><br /><span style="color: rgb(0, 0, 153); font-weight: bold; font-style: italic;"> from all_objects)</span><br /><span style="color: rgb(0, 0, 153); font-weight: bold; font-style: italic;"> where rownum<=length(lv_string))</span><br /><span style="color: rgb(0, 0, 153); font-weight: bold; font-style: italic;">group by lv_char; </span><br /><br />Can you generate Monthly Calender for current year using a SQL query? Sounds interesting is not it? I took up this challenge couple of years back and solve it just by using DECODE and ROWNUM. Perhaps I can share that in another post.Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com0tag:blogger.com,1999:blog-30035103.post-63103838129394841402010-01-30T00:16:00.002+05:302010-01-30T00:18:59.668+05:3010 Digit NumberA ten-digit number contains every digit from 0 to 9. The digits are arranged so that the number formed by the first two digits, reading from left to right, is divisible by 2, the number formed by the first 3 digits is divisible by 3, the first 4 by 4, and so on until the whole number is divisible by 10.<br /><br />What is the number? There are two digits that can be placed immediately. Which are they?Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com1tag:blogger.com,1999:blog-30035103.post-62884852212110568542010-01-28T22:34:00.000+05:302010-03-04T12:36:42.798+05:30I am back :-} ...A simple puzzle to start withI would like to start with a simple puzzle which I had come across recently. I guess this is a straight forward one... Give it a try :-}<br /><br />4 criminals are caught and are to be punished. The Judge allows them to be freed if they can solve a puzzle. If they do not, they will be hung. They agreed.<br /><br />The 4 criminals are lined up on some steps (shown in picture). They are all facing in the same direction. A wall separates the fourth man from the other three.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_NqZVIoMDQWA/S2HFJr4-Z6I/AAAAAAAABMs/HeyHvpWtdXg/s1600-h/image001.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 200px;" src="http://4.bp.blogspot.com/_NqZVIoMDQWA/S2HFJr4-Z6I/AAAAAAAABMs/HeyHvpWtdXg/s400/image001.gif" alt="" id="BLOGGER_PHOTO_ID_5431839395776718754" border="0" /></a><br />So to summarise :-<br />Man 1 can see men 2 and 3.<br />Man 2 can see man 3.<br />Man 3 can see none of the others.<br />Man 4 can see none of the others.<br /><br />The criminals are wearing hats. They are told that there are two white hats and two black hats. The men initially don't know what colour hat they are wearing. They are told to shout out the colour of the hat that they are wearing as soon as they know for certain what colour it is.<br /><br />They are not allowed to turn round or move.<br />They are not allowed to talk to each other.<br />They are not allowed to take their hats off.<br /><br />Who is the first person to shout out and why?<br /><br />--JamieJameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com3tag:blogger.com,1999:blog-30035103.post-57931282618937664082008-09-28T10:40:00.000+05:302008-09-28T12:53:48.776+05:30எந்தக் கடையில... நீ அரிசி வாங்குற...<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_NqZVIoMDQWA/SN8o0gmZdwI/AAAAAAAAAzA/gUAbjGmq7GQ/s1600-h/tummy.JPG"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="http://1.bp.blogspot.com/_NqZVIoMDQWA/SN8o0gmZdwI/AAAAAAAAAzA/gUAbjGmq7GQ/s400/tummy.JPG" alt="" id="BLOGGER_PHOTO_ID_5250960573106583298" border="0" /></a><br /><br />Overweight - IT துறையில் இருப்பவர்களின் தீராத தலை வலி. இத்துறையில் இருக்கும் நானும் இதற்கு விதிவிலக்கு இல்லை. என்னுடைய BMI விகிதம் 25 க்கு மிக அருகில் இருந்தாலும் இப்போது விட்டுவிட்டால் பின்னால் எடையைக் குறைப்பது ரொம்ப கஷ்டம் அப்படிங்கிற கிலி மனசுல இருந்துட்டே இருக்கு.<br /><br />கழுத கெட்ட குட்டிசுவரு...Software engineer க்கு doubt ன்னா google search அப்படிங்கிற மாதிரி (பழமொழிய தப்ப use பன்னுரனானு தெரியல) ... உடற்பயிற்சியை தவிர வேற என்ன விஷயங்கள்ள கவனம் செலுத்தனும் அப்படின்னு தேட ஆரம்பிச்சேன்... பெரும்பாலான இடங்கள்ல உடற்பயிற்சியோடு முக்கியமா சொல்லப்படுற இன்னொரு விஷயம் வளர்சிதை மாற்ற விகிதம் (Metabolism Rate).<br /><br />நம்மவர்களில் நிறைய பேர் ஒல்லியாகவோ குண்டாகவோ இருப்பதற்கு முக்கியக் காரணம் அவரவரின் Metabolism Rate தான் முக்கிய காரணமாம். தொடர்ச்சியான உடற்பயிற்சி Metabolism Rate- ஐ சீரான நிலைக்கு கொண்டு வரும் என்றாலும் அது மட்டும் போதாதாம். இதனால் தான் உடற்பயிற்சி செய்யும் சிலரால் கூட உடல் எடையை குறைக்க முடிவதில்லையாம். மேலும் Metabolism Rate- ஐ சீரான நிலைக்கு கொண்டு வருவதற்கு சில TIPS கள் இங்கே,<br /><br />1. உடல் எடையை குறைப்பதற்காக fasting என்ற பெயரில் சாப்பிடாமல் இருந்து விடக்கூடாது. இது Metabolism Rate- ஐ குறைத்து விடும். விளைவு... "low calories burn". இதற்கு பதில் நாளுக்கு ஐந்து முதல் ஆறு முறை சாப்பிடுவது நல்லது... ஆனா அதுக்காக ஆறுமுறையும் ஜம்போ meals சாப்பிடக்கூடாதுங்க... இப்படி சொல்லுறதுக்கு முக்கிய காரணம் ரெண்டு meal -யுக்கு உள்ள இடைவேளை தோராயமாக 3 மணி நேரம் இருப்பது நல்லதாம். <span></span><br /><br />2. அநேகமாக நாம் அனைவரும் கேள்வி பட்ட ஒரு வைத்தியம்...<br /> காலையில் இளம் சுடுநீரில் தேனை கலந்து பருகுவது. இதோடு எலும்பிச்சை சாரையும் கலந்து குடித்தால் Metabolism Rate என்று நம்பப்படுகிறது.<br /><br />இதை நான் முயன்று பார்ப்பது என்று முடிவு செய்து விட்டேன்.<br /><br />3. சீரான உடற்பயிற்சி...இது கண்டிப்பாக Metabolism Rate- ஐ கூட்டும்.<br />தினமும் 20 முதல் 30 நிமிடங்கள் நடந்தால் கூட போதும்.<br /><br />4. தேவையான அளவுக்கு தூங்குங்கள். நாம் தேவையான அளவுக்கு தூங்கவில்லை என்றாலும் Metabolism Rate <span></span>குறைந்து விடுமாம்.<br /><br />இப்படி list நீண்டுட்டே போகுதுங்க...ஆனா நான் இதோட நிறுத்திக்கிறேன்.<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_NqZVIoMDQWA/SN8wqh5ZroI/AAAAAAAAAzI/8xs1TH8FJXQ/s1600-h/shutterstock_851492_1_.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_NqZVIoMDQWA/SN8wqh5ZroI/AAAAAAAAAzI/8xs1TH8FJXQ/s400/shutterstock_851492_1_.JPG" alt="" id="BLOGGER_PHOTO_ID_5250969197749055106" border="0" /></a><br /><br /><br />என்க்கு fitness பத்தி நினைக்கும் பொது எல்லாம் என் நண்பன் சொன்னது ஞாபகம் வரும்...software engineers எல்லாம் ஒரு நாளைக்கு 2 மணிநேரம் கூலி வேலை சையனும்னு சட்டம் கொண்டுவரனும் அப்ப தான் IT மக்கள் fit ஆகவும் இருப்பாங்க அதோட பணத்தோட அருமையும் அவங்களுக்கு தெரியும்னு சொல்லுவான்...<br /><br />ஆனா என்னைப்பொருத்தவரை இந்த சட்டம் கொண்டுவந்தா என்ன நடக்கும் தெரியுமா? இப்ப credit card call வருவது மாதிரி ஒன்னொரு புது call வரும்...Sir நாங்க company A ல இருந்து call பண்ணுறோம்...உங்களுக்கு பதிலா 2 மணிநேரம் கூலி வேலை பாக்குறதுக்கு ஆள் arrange பண்ணுறோம் அதுக்கு நீங்க just Rs.1,000 மட்டும் pay பண்ணினா போதும்... அதுக்கு நம்ம ஆளு என்ன பதில் சொல்லுவார் தெரியுமா... Actually company B ல Rs.750 தான் charge பண்ணுறாங்க நீங்க ஜாஸ்தியா சொல்லுறிங்களே...<br /><br />அது சரி இப்ப serious ஆன விஷயத்துக்கு வருவோம்...overweight பிரச்சனைய வெற்றிகரமா முறியடுச்சவங்க கண்டிப்பா நிறைய பேர் இருப்பிங்க...உங்கள்ள யாரவது useful tips தரலாமே...Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com2tag:blogger.com,1999:blog-30035103.post-32043628855397660582008-09-16T23:06:00.000+05:302008-09-16T23:34:50.839+05:30Know my Personality...Today, I got bored of work and not in a good mood to work ...When I am in to such a situation I used to some crazy things. Today I wanted to give a Personality test. So I just googled for "Personality Test" and clicked on the very first link which says <a href="http://www.humanmetrics.com/cgi-win/JTypes2.asp">"Personality test based on Jung - Myers-Briggs typology"</a>.<br /><br />It had about 72 question and I took nearly 15 mins to complete the test. I think I should not have taken this much time and I do not know how accurate the result could be.<br /><br />It predicted that my personality type is ENFP - Extraverted iNtuitive Feeling Perceiving or in other words "An Idealist Champion".<br /><br />Here are some interesting links about my personality type,<br /><br />http://www.personalityzone.com/group/career-zone/view/temperament/champion.html<br /><br />http://www.personalitypage.com/ENFP.html<br /><br />http://typelogic.com/enfp.html<br /><br />For people don't care to read all these urls , <span style="color: rgb(0, 0, 160);font-size:130%;" >ENFPs are charming, ingenuous, risk-taking, sensitive, people-oriented individuals with capabilities ranging across a broad spectrum.<br /><br /><br /></span>I am not sure whether it is worth to take this test . Though I am not 100% convinced with my personality type definition I would say you can give it a go...& do update me with your personality type.<br /><br />With Luv,<br /><span style="font-style: italic;">The Idealist Champion</span>Jameshttp://www.blogger.com/profile/12461190623386052813noreply@blogger.com4