Submitted by: Submitted by NStewart93207
Views: 10
Words: 589
Pages: 3
Category: Business and Industry
Date Submitted: 10/24/2016 04:08 PM
, In-Class Activity: Table Creation and Management
1. Create a new table containing the category code and description for the categories of books sold by Justlee. The table should be called CATEGORY and the columns should be catcode and catdesc. The catcode column should store a max of 2 characters and the catdesc should store a max of 10 characters.
Create table category
(catcode varchar2(2),
Catdesc varchar2 (10));
2. Create a new table containing 4 columns. The columns should be Emp#, Lastname, Firstname, Job_class. Name the table Employees. The job_class column should be able to store character strings up to a max length of four, but the column values shouldn’t be padded if the value has less than four characters. The emp# column should be a numeric ID and should allow a five digit number. Use column sizes you think are appropriate for firstname and lastname columns.
Create table employees
(emp# varchar2(5), lastname varchar2(15), firstname varchar2(10), job_class varchar2(4));
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 the employees date of termination.
Alter table employees
Add (empdate date, enddate date);
4. Modify the Job_class column of the employees table so that it allows storing a max width of two characters.
Alter table employees
Modify job_class varchar2(2);
5. Delete the Enddate column from the employees table.
Alter table employees
Drop column enddate;
6. Rename the Employees table as JL_Emps
Rename employees to JL_Emps;
7. Create a new table with 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...