Topic: Mother of Mercy  (Read 3661 times)

0 Members and 1 Guest are viewing this topic.

Offline toasty0

  • Application.Quit();
  • Captain
  • *
  • Posts: 8045
  • Gender: Male
Mother of Mercy
« on: October 27, 2008, 07:44:27 am »
I'm prepping for an upcoming test. This is one of the questions
---------------------------------------------------------------------------------------------------

You are a database developer for your company. You are responsible for a Microsoft SQL Server 2005 database named VolunteerGroupData. Your company uses the database to track the volunteer groups that run concession stands during events at a sports stadium.

The database contains a table named GroupPayments that you use to record the amount of money paid to a group for an event. The table contains four columns:

* EventDate - a user-defined data type value to record the date of each event
* StandNum - a tinyint value to record the number assigned to each concession stand
* GroupNum - a smallint value to record the number assigned to each group
* Payment - a money value to record the amount of money earned by a group for an event

An employee plans to feature the three groups that earned the most money during July, 2005, in an article she is writing for a newsletter.

You need to use GroupPayments to determine which three groups she should feature in the article. Your solution should optimize query performance.

Which statement or statements should you use?

 SET ROWCOUNT 3;
SELECT GroupNum, SUM (Payment) AS GroupTot
FROM GroupPayments
WHERE EventDate BETWEEN 'July 1, 2005' AND 'August 1, 2005'
GROUP BY GroupNum
ORDER BY GroupTot;
 
 SET ROWCOUNT 3;
SELECT GroupNum, SUM (Payment) AS GroupTot, EventDate
FROM GroupPayments
WHERE EventDate BETWEEN 'July 1, 2005' AND 'July 31, 2005'
GROUP BY GroupNum
ORDER BY GroupTot;
 
 SELECT TOP (3) GroupNum, SUM (Payment) AS GroupTot
FROM GroupPayments
WHERE EventDate BETWEEN 'July 1, 2005' AND 'July 31, 2005'
GROUP BY GroupNum
ORDER BY GroupTot DESC;
 
 SELECT TOP (3) GroupNum, SUM (Payment) AS GroupTot, EventDate
FROM GroupPayments
WHERE EventDate BETWEEN 'July 1, 2005' AND 'August 1, 2005'
GROUP BY GroupNum
ORDER BY GroupTot;
 ---------------------------------------------------------------------------------------------------------------------------------

I'll post some others later.
MCTS: SQL Server 2005 | MCP: Windows Server 2003 | MCTS: Microsoft Certified Technology Specialist | MCT: Microsoft Certified Trainer | MOS: Microsoft Office Specialist 2003 | VSP: VMware Sales Professional | MCTS: Vista

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: Mother of Mercy
« Reply #1 on: October 27, 2008, 09:27:54 am »
I'm prepping for an upcoming test. This is one of the questions

You got the questions first?  :skeptic:  You be cheatin?  ;)

Too bad SQL is not standardised, or I'd help, but queries that work on MSSQL, may or may not work on MySQL and may or may not work on Oracle... a real shame, I guess you call it "vendor lock-in" and they're all guilty of it.

Offline FCM_SFHQ_XC

  • There is life outside of Windows..
  • Administrator
  • Lt. Commander
  • *
  • Posts: 2267
  • Gender: Male
  • Starbase Atlantis [X-refit]
    • 9th Fleet
Re: Mother of Mercy
« Reply #2 on: October 27, 2008, 09:46:39 am »
Wish I had the time to learn some of the differences in what works and what doesnt between MySQL and MS SQL, but that I guess will be a future plan somewhere down the line. In the meantime..

if(questionIsMSSQL && (notWorkingInMySQL || notWorkingInOracle)) //methods prevously returned boolean vars in if statement to determine if it works in MySQL and Oracle
{
   initiatePlanentarySelfDestruct(60);  //Self destruct method, input countdown in seconds. If it is MSSQL & not working elsewhere, best just remove the pretty blue planet in the inner solar system
}
else
{
   celebration(); //Celebrate, the end of the world will not come in 2012 since the question is not MSSQL or it at least works across the board
}
Starfleet Headquarters out.

Fleet Commodore, XenoCorp, ISC Fleet.

Offline toasty0

  • Application.Quit();
  • Captain
  • *
  • Posts: 8045
  • Gender: Male
Re: Mother of Mercy
« Reply #3 on: October 27, 2008, 01:23:59 pm »
Wish I had the time to learn some of the differences in what works and what doesnt between MySQL and MS SQL, but that I guess will be a future plan somewhere down the line. In the meantime..

if(questionIsMSSQL && (notWorkingInMySQL || notWorkingInOracle)) //methods prevously returned boolean vars in if statement to determine if it works in MySQL and Oracle
{
   initiatePlanentarySelfDestruct(60);  //Self destruct method, input countdown in seconds. If it is MSSQL & not working elsewhere, best just remove the pretty blue planet in the inner solar system
}
else
{
   celebration(); //Celebrate, the end of the world will not come in 2012 since the question is not MSSQL or it at least works across the board
}

 :rofl:
MCTS: SQL Server 2005 | MCP: Windows Server 2003 | MCTS: Microsoft Certified Technology Specialist | MCT: Microsoft Certified Trainer | MOS: Microsoft Office Specialist 2003 | VSP: VMware Sales Professional | MCTS: Vista

Offline Dash Jones

  • Sub-Commander of the Dark Side
  • Captain
  • *
  • Posts: 6477
  • Gender: Male
Re: Mother of Mercy
« Reply #4 on: October 27, 2008, 02:02:20 pm »
How do you know the questions before you even take the test?
"All hominins are hominids, but not all hominids are hominins."


"Is this a Christian perspective?

Now where in the Bible does it say if someone does something stupid you should shoot them in the face?"

-------

We have whale farms in Jersey.   They're called McDonald's.

There is no "I" in team. There are two "I"s in Vin Diesel. screw you, team.

Offline toasty0

  • Application.Quit();
  • Captain
  • *
  • Posts: 8045
  • Gender: Male
Re: Mother of Mercy
« Reply #5 on: October 27, 2008, 03:28:51 pm »
It's a prep exam question.

Can you imagine the what the real exam question will be like?
MCTS: SQL Server 2005 | MCP: Windows Server 2003 | MCTS: Microsoft Certified Technology Specialist | MCT: Microsoft Certified Trainer | MOS: Microsoft Office Specialist 2003 | VSP: VMware Sales Professional | MCTS: Vista

Offline Dracho

  • Global Moderator
  • Rear Admiral
  • *
  • Posts: 18289
  • Gender: Male
Re: Mother of Mercy
« Reply #6 on: October 27, 2008, 05:08:41 pm »
www.transcender.com sells a ton of practice exams.  The CISSP prep exam I purchased from them (I am convinced) was invaluable in helping me pass that behemoth.

I'm also studying for the PMI exam with some of their tests, but am getting a detour next week through the CPISM and CPISA.
The worst enemy of a good plan is the dream of a perfect plan.  - Karl von Clausewitz

Offline toasty0

  • Application.Quit();
  • Captain
  • *
  • Posts: 8045
  • Gender: Male
Re: Mother of Mercy
« Reply #7 on: October 27, 2008, 06:30:47 pm »
They're good. I think for an MS test though MeasureUp is the test of choice with ExamCram coming up a close second. For anything not MS Transcender is head and shoulders above all other contenders.
MCTS: SQL Server 2005 | MCP: Windows Server 2003 | MCTS: Microsoft Certified Technology Specialist | MCT: Microsoft Certified Trainer | MOS: Microsoft Office Specialist 2003 | VSP: VMware Sales Professional | MCTS: Vista

Offline FCM_SFHQ_XC

  • There is life outside of Windows..
  • Administrator
  • Lt. Commander
  • *
  • Posts: 2267
  • Gender: Male
  • Starbase Atlantis [X-refit]
    • 9th Fleet
Re: Mother of Mercy
« Reply #8 on: October 27, 2008, 06:47:11 pm »
It's a prep exam question.

Can you imagine the what the real exam question will be like?
sometimes the prep exams are much harder then the actual exam too :)
Starfleet Headquarters out.

Fleet Commodore, XenoCorp, ISC Fleet.

Offline Sirgod

  • Whooot Master Cattle Baron
  • Global Moderator
  • Vice Admiral
  • *
  • Posts: 27831
  • Gender: Male
Re: Mother of Mercy
« Reply #9 on: October 27, 2008, 07:53:59 pm »
Why not just print it out, and look at who made the most money? seems far easier that way.

Stephen
"You cannot exaggerate about the Marines. They are convinced to the point of arrogance, that they are the most ferocious fighters on earth - and the amusing thing about it is that they are."- Father Kevin Keaney, Chaplain, Korean War

Offline toasty0

  • Application.Quit();
  • Captain
  • *
  • Posts: 8045
  • Gender: Male
Re: Mother of Mercy
« Reply #10 on: October 27, 2008, 09:07:41 pm »
It's a prep exam question.

Can you imagine the what the real exam question will be like?
sometimes the prep exams are much harder then the actual exam too :)

One can hope so. ;)
MCTS: SQL Server 2005 | MCP: Windows Server 2003 | MCTS: Microsoft Certified Technology Specialist | MCT: Microsoft Certified Trainer | MOS: Microsoft Office Specialist 2003 | VSP: VMware Sales Professional | MCTS: Vista