Project 1

Due Date: Wedensday May 31

Points: 40

I thought we might as well do something useful for real life. Analyze Lottery Numbers!! Go to http://www.state.nj.us/lottery/games/1-3-3_jc5_history.shtml
1) Create a table named NJ5 with five columns called N1, N2, N3, N4, and N5.
[5 points]

2) Insert data from the beginning of the month of May 
until May 20 into this table. (Note: For now we will not 
use the date or payout information.  Only the numbers.  Note also
that the most recent entry will be at the bottom of the table!!!)

Make sure you show both your SQL statements and the result of doing them,
i.e., the complete table created.  The burden of proof is on you.
[15 points]

3) Write SQL statements for the following queries.  Show the SQL and the
result.  You cannot do any part of this by hand, it all has to be done
by SQL. [2 points each.]

a) Show all the numbers of all the columns.  (The whole table.)

b) Show all the numbers of the first column.

c) Show all the numbers of the first and third column together.

d) Show the largest number of each column.

e) Show the smallest number of each column.

f) Show the average of each column.

g) Find out how often the number 6 occurred in the column N1.

h) Show all numbers in column one that are greater than 10 and less than 15.
Display both column one and column two (but not the others).

i) Display all rows where the number in the second column is exactly
1 more than the number in the first column.

j) Display the difference of the last column minus the first column
where this difference is greater than 20.  Display the difference, the
first column and the last column.


THE FOLLOWING APPLIES TO ALL HOMEWORKS:

- Cover Page
  Every assignment must have a typed cover page
  your name, assignment number, class number and a descriptive
  title of the assignment.  Make it look good.

  All parts of your assignment need to be stapled 
  together, or held together by a folder.  

  No handwriting anywhere.

- Documentation:
  For every SQL statement write a comment what it does.

- Test runs:
  Show a test run for every single SQL question.  Everything that you 
  don't show will be assumed "not working."  NO TESTRUNS, NO POINTS. 
  (Or very, very few.)
  [In this assignment you need to show a screen dump of your tables.]

- Hardcopy:
  All code, documentation, and testruns will be accepted as Hardcopy
  (Printout) ONLY.  No email, No fax etc.

- Grading:
  Grading takes into account correctness of the results, but also
  how well they are documented, and what their visual appearance is.
  Things should look nice and professional.  Not sloppy.  Use a spelling
  corrector for your comments.

- Cheating:
  The usual policies apply.  0 points for "suspiciously similar" results.
  Report to the Dean in case of repetition.

- Files:
  You must keep all your files of every assignment up to the end of
  the term.  If there is any doubt about your assignment I will
  ask you to demonstrate it online.

- Late policy:
  I will take off 10 points for being late up to 6 days.  Homeworks
  that are handed in more than a six days late will receive no credit
  at all, unless you have a good reason with WRITTEN documentation
  (usually medical).