Assignments

  1. All hand-ins consist of ONE, repeat ONE compressed zip/jar/tgz-archive.
  2. An archive consists of one or more text files and/or code files.
  3. Text processed files must be pdf-files.
  4. Code files must be have their native filename extension, eg. x.java, y.html, etc.
  5. Put your academy login-id into the filename, and an "_7" to number the file individually, eg: EAANILA1_7.zip
  6. Put the token dbxml somewhere in the subject, eg: Assignments dbxml
  7. Mail it to nml@acm.org

Create a table t2 with an auto_incremented key pk1, an attribute visited of type date, an attribute name to hold a name, and an attribute to hold a random number.

Then create a procedure to insert one row in the table, the name must be given as a parameter, the rest of the values must be given by the DBMS at the time of the insert.

Hand in as one (1) file assign100.sql. The file must hold the create table declaration, the create procedure declaration, followed by at least 5 call declarations illustrating usage.

Look at the following scenario:

mysql> describe t3//
+---------+-------------+------+-----+---------+-------+
| Field   | Type        | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| dist    | int(11)     | NO   | PRI | NULL    |       |
| repno   | int(11)     | NO   |     | NULL    |       |
| repname | varchar(16) | NO   |     | NULL    |       |
+---------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql> describe t4//
+----------+-------------+------+-----+---------+----------------+
| Field    | Type        | Null | Key | Default | Extra          |
+----------+-------------+------+-----+---------+----------------+
| cust     | int(11)     | NO   | PRI | NULL    | auto_increment |
| custname | varchar(16) | NO   |     | NULL    |                |
| district | int(11)     | NO   | MUL | NULL    |                |
| revenue  | float       | NO   |     | NULL    |                |
+----------+-------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

Create a procedure doing the following:

  1. Create an innodb table t3. It will contain sales districts, re example above
  2. Create an innodb table t4 for customers belonging to the sales districts of t3. Re example of t4 above
  3. Insert 5 districts into t3, and belonging to each of those 5 districs, 10000 customers must be inserted into t4.