I got these questions on a recent interview if you want to answer you can, but please give some explanation as to how you got the answer or jot them down and learn them -- just for fun . . . I'll post my answers as well

1. N is an integer and N>1. Write a simple program to solve the following problem. Use any computer language or flow chart. Syntax is not critical.

2. Invoice Header File: invhdr

Invoice Number: inv_no
Date sold: inv_dt
Customer ID: inv_cust

Invoice Detail file: invdtl

Invoice Number: inv_no
Item ID: inv_item
Quantity(integer):inv_qty


Write a SQL statement to provide the following information.
Total quantity sold for item ID 10101 during February, 2000, excluding Customer ID 21225.











3. Assume that the above tables don’t have any indexes. What indexes will you create to improve the performance of that particular statement? Write SQL statements to create indexes.