0% found this document useful (0 votes)
146 views

Class Practical 3

The document provides instructions for students to perform tasks in a database like creating and modifying tables, adding and deleting columns, and truncating and deleting tables. It also includes an advanced challenge to implement changes to support a new commission and benefits system.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views

Class Practical 3

The document provides instructions for students to perform tasks in a database like creating and modifying tables, adding and deleting columns, and truncating and deleting tables. It also includes an advanced challenge to implement changes to support a new commission and benefits system.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

INF313 – CLASS PRACTICAL 3

Chapter 3 – Table Creation and Management


INSTRUCTIONS:
Use the “JustLee_Books” database to answer these questions. To determine the
exact name of fields used in the tables for these exercises, use the DESCRIBE
tablename command to view the table’s structure, then use the database to answer
these questions.

TASKS:
1. Create a new table containing the category code and description for the categories
of books sold by “JustLee Books”. The table should be called CATEGORY, and
the columns should be CatCode and CatDesc. The CatCode column should store
a maximum of 2 characters, and the CatDesc column should store a maximum of
10 characters.
2. Create a new table containing these four columns: Emp#, Lastname, Firstname,
and Job_class. The table name should be EMPLOYEES. The Job_class column
should be able to store character strings up to a maximum length of four, but the
column values shouldn’t be padded if the value has less than four characters. The
Emp# column contains a numeric ID and should allow a five-digit number. Use
column sizes you consider suitable for the Firstname and Lastname columns.
3. Add two columns to the EMPLOYEES table. One column, named EmpDate,
contains the date of employment for each employee, and its default value should
be the system date. The second column, named EndDate, contains employees’
date of termination.
4. Modify the Job_class column of the EMPLOYEES table so that it allows storing a
maximum width of two characters.
5. Delete the EndDate column from the EMPLOYEES table.
6. Rename the EMPLOYEES table as JL_EMPS.
7. Create a new table containing these four columns from the existing BOOKS table:
ISBN, Cost, Retail, and Category. The name of the ISBN column should be ID,
and the other columns should keep their original names. Name the new table
BOOK_PRICING.

1
INF313 – CLASS PRACTICAL 3
Chapter 3 – Table Creation and Management
8. Mark the Category column of the BOOK_PRICING table as unused. Verify that the
column is no longer available.
9. Truncate the BOOK_PRICING table, and then verify that the table still exists but no
longer contains any data.
10. Delete the BOOK_PRICING table permanently so that it isn’t moved to the recycle
bin. Delete the JL_EMPS table so that it can be restored. Restore the JL_EMPS
table and verify that it’s available again.

ADVANCED CHALLENGE
The management of “JustLee Books” has approved implementing a new commission
policy and benefits plan for the account managers. The following changes need to be
made to the existing database:
 Two new columns must be added to the ACCTMANAGER table: one to indicate
the commission classification assigned to each employee and another to contain
each employee’s benefits code. The commission classification column should be
able to store integers up to a maximum value of 99 and be named Comm_id. The
value of the Comm_id column should be set to a value of 10 automatically if no
value is provided when a row is added. The benefits code column should also
accommodate integer values up to a maximum of 99 and be named Ben_id.
 A new table, COMMRATE, must be created to store the commission rate schedule
and must contain the following columns:
 Comm_id: A numeric column similar to the one added to the
ACCTMANAGER table.
 Comm_rank: A character field that can store a rank name allowing up to 15
characters.
 Rate: A numeric field that can store two decimal digits (such as .01 or .03).
 A new table, BENEFITS, must be created to store the available benefit plan options
and must contain the following columns:
 Ben_id: A numeric column similar to the one added to the ACCTMANAGER
table.
 Ben_plan: A character field that can store a single character value.
2
INF313 – CLASS PRACTICAL 3
Chapter 3 – Table Creation and Management
 Ben_provider: A numeric field that can store a three-digit integer.
 Active: A character field that can hold a value of Y or N.

REQUIRED:
Create the SQL statements to address the changes needed to support the new
commission and benefits data.

******************** END ********************

You might also like