TEC 5323 Advanced Database Technology


 

Project 7 Create Database Tables

Background:

A sales order database needs the following two tables.

CUSTOMER: used to record all customer contact information.

CUST_ID LAST_NAME FIRST_NAME MIDDLE ADDRESS CITY STATE ZIP D_PHONE E_PHONE
107 Harris Puala E 1156 Jefferson Ave Charleston IL 61920 2175812223 2173480022
232 Edward Mich M 4204 Grant Street Mattoon IL 61938 2172355537 2173482322
133 Carcia Maria H 2211 Oak Lane Champaign IL 61821 2173334589 2172448973
154 Miller Reggie   699 Pruto St Urbana IL 61801 2175816645 2172337654
179 Woods Tigerlet   987 Durham Road Tilton IL 61833 2173350045 2175452376

CUST_ORDER: used to enter customers' order information (not order details).

ORDER_ID ORDER_DATE PAY_METHOD CUST_ID ORDER_SOURCE_ID
1057 5/29/2001 CC 107 2
1058 5/29/2001 CC 232 6
1059 6/10/2001 CHECK 133 2
1060 6/21/2001 CC 154 3
1061 6/30/2001 CC 179 6
1062 7/1/2001 CC 179 3

Please note that CUST_ID in CUST_ORDER table correspond to CUST_ID in CUSTOMER table. In other words, customer information needs to exist before customer can take an order.

Tasks:

You will create a SQL script (10 points off if not in one file) in order to accomplish the following tasks.

    1. Connect to scott/tiger schema (5 points)
    2. Create the above two tables in the scott/tiger schema. (15 points)
    3. Define column datatypes based upon the type of data to be entered, as shown in the tables. (20 points)
    4. In CUSTOMER table, define CUST_ID as primary key. In CUST_ORDER table, ORDER_ID is a primary key. (20 points)
    5. Define and create parent-child relation between the two tables. (10 points)
    6. Insert (populate) data into the two tables. (20 points)
    7. Please make sure that the exact spelling (as specified) is required on names of table and data fields. Otherwise, you will lose points.

    Tip:

    While the details on data type are not within the scope of this course, please use some common sense when you define the data type.  For instances, CUST_ID field will be large enough to accommodate future growth of your organization.  ZIP, D_Phone and E_Phone should be defined as VARCHAR2 instead of Number since those data will not be involved in any future computations and they will not be truncated (i.e. if ZIP code is 00212).

 

Report:

Submit your project through WebCT. If you need instructions on how to submit, click here.

Please submit your SQL script for performing the tasks of this project. (SQL script is in .sql format, which can be run in Oracle as SQL>@filepath\file.sql, for example, SQL>@C:\temp\myscript.sql.)

Please use the same file convention for this course.

Due:

At the end of this week. Please see the course schedule for exact due date.

Class Index
 

School of Technology
College of Business & Applied Sciences
Eastern Illinois University