Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Challenge Will donate for answer

Author  Topic 

KcinMan11358
Starting Member

4 Posts

Posted - 2010-11-29 : 13:50:00
There are two bonus questions that were presented to us today in my database class. The prof said there will be a 20 E.C. question similar to these two on our next exam. While I have no idea how to do them, I figure if anyone here knows how, I can atleast give it a shot on the exam:
1)Write a program to do this to print out some like: may need to use two loops.
1 1
2 1 2
3 1 2 3
4 1 2 3 4
….
10 1 2 3 4 5 6 7 8 9 10

2) Write a program to find the maximum number and the minimum number in the following 10 numbers. You also need to print out the sequence number of the maximum number and that of the minimum number in the list. Your output should look like
Maximum number: 999. Sequence in the list: 7.
Minimum number: 005. Sequence in the list: 2.
Two ways to do this:
1. create a table and insert the numbers into the table. Select top @rownumber from the table. Top @rownumber means top 1, top 2, top 3, and so on to 10. @rownumber is a variable.
2. Take the following as a string. Get three letters out of the string every time, starting from a particular location. Need to use a loop to do this.
009,005,123,143,666,345,999,134,006,028.

Thanks and I will donate if solutions are found

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-11-29 : 14:02:38
We don't answer homework or exam questions on SQL Team.
Go to Top of Page
   

- Advertisement -