Create a table for database transformation , Database Management System

Step 1. Using Oracle, create the tables identified in the preferred solution for Assignment 2.

Technicians (ZipCode, TechnicianID, FirstName, LastName, Street, City, State, HomePhone, WorkPhone)

ZipCode is the Primary Key and should be 5 character fixed length data. TechnicianID - should be 3 character fixed length data. State should be 2 character fixed length data.

Customers (CustomerNum, FirstName, LastName, Street, City, State, ZipCode, Phone, OutsideOnly)

CustomerNum is the Primary Key and should be 3 character fixed length data. State should be 2 character fixed length data. ZipCode - Is the Foreign Key relating the Technician and the Customers tables and should be 5 character fixed length data. OutsideOnly is a 1 character fixed length data.

Chemicals (ChemicalNum, ChemicalName, PricePerPound)

ChemicalNum is the Primary Key and should be 2 character fixed length data. PricePerPound should be numeric data. 4 digits maximum with two allocated to the right of the decimal place.

Treatments Table

Create Table Treatments ( ServiceDate Date, ChemicalNum Char(2) Constraint Treatments_ServiceDate_FK References Chemicals(ChemicalNum), CustomerNum Char(3) Constraint Treatments_CustomerNum_FK References Customers(CustomerNum), QuantityUsed Number, Constraint Treatements_3Combo_PK Primary Key(ServiceDate, ChemicalNum, CustomerNum) );

Due to the complexity of the Treatment Table, the create table code has been provided to you. Note that we are setting up the service Date with the Data datatype and the ChemicalNum and CustomerNum are Foreign Keys relating respectively to the Chemicals and Customers tables. QuanitiyUsed is set up as a floating numeric data field, because it can accept numbers who have a floating decimal place or whole numbers. Note that this table has a combination primary key that consist of the ServiceDate, ChemicalNum and the CustomerNum in combination.


 Use the proper naming convention for your constraints: Example: Constraint TableName_FieldName_ConstraintID (Customer_CusNum_PK) Set up the Primary Keys for each table with Constraints listed. Add Your Foreign Keys for each table with Constraints listed. All Required fields are listed above in redand should have constraints set up for them. Make the Data Types for the remaining fields either fixed or variable length character data. I will leave it up to you do decide which of the remaining fields should be fixed vs. variable, as well as determining their size.

 Step 2.

Create the queries listed below:

NOTE: Before you begin to run Queries 1 - 11, Enter the following two commands at the SQL Prompt:

Set Linesize 120 Set Pagesize 70

This will allow you to see all of your data without it wrapping.

1. Select all records from each table - Label Q1a-Q1d

2. List all of your constraints in the database one table at a time. - Label Q2a-Q2d

3. List all of your table names in the database. - Label Q3

4. List the Columns and data types of each table - Label Q4a-Q4d

5. List the customer information of any customer who only gets outside service. Label Q5

6. List the customers information for any customer who lives in Potsdam or Pensville and who do not get outside service only. Label Q6

7. List the Technician ID, and their first and last name along with each of their customer's number and first and last name. Use Table Aliases of T for Technicians Table and C for Customers Table. Also use Column Aliases as follows: TechFirst, TechLast, CusFirst, CustLast . Label Q7

8. List the first name , last name and street address of any pair of customers whose address contains "Rd". Label Q8

9. List the Technician's ID, Customer Number, Date of Service, Chemical used and the amount of chemical used. Primary Sort Key is Technician's ID in ascending order and the Secondary Sort key is Customer Number in descending order. Label Q9

10. Repeat Question 9 above, but lets add the price per pound of each chemical and lets calculate the total cost of each chemical used at each house. Place price per before quantity used and the total chemical cost after quantity used as a column aliases named "Chemical Charge". Label Q10

11. List the name Chemical number, name and price per pound of any chemical that has not been used at a house. Hint: Combination of two very difficult SQL Concepts.

Posted Date: 3/11/2013 5:55:40 AM | Location : United States

Related Discussions:- Create a table for database transformation , Assignment Help, Ask Question on Create a table for database transformation , Get Answer, Expert's Help, Create a table for database transformation Discussions

Write discussion on Create a table for database transformation
Your posts are moderated
Related Questions
Question: (a) Define the term e-Government and briefly explain, using appropriate examples, the aspects it covers. (b) Give four reasons as to why a country should adopt e

What do you mean through integrity constraints? Integrity Constraints -An integrity constraint is a condition specified on a database schema and restricts the data in which

Define the terms  1) physical schema 2) logical schema.  Physical schema:  The physical schema explains the database design at the physical level, which  is  the  lowest  lev

Entity types that do not have any key attribute, and therefore cannot be identified independently, are known as weak entity types. A weak entity can be recognized uniquely only by

Explain Network Model in DBMS? Network Model - It was formalised within the late year of 1960s through the Database Task Group of the Conference on Data System Language (DBTG

Objectives After reading this part, you should be able to: Modify, create, and delete database schema objects; Update database using SQL command; Retrieve data f

Question: (a) What are decision support systems, and what role do they play in the business environment? (b) Data mining is a knowledge discovery process of automated extr

Define physical and logical data independence. How does this architecture help in achieving these? Data independence entails that change in one view must not need a change in t

Discuss how the bi-directional Implementations are made. In bi-directional implementation of the association, a pair of references must implement every link. The declarations a

Define cardinality and participation constraints on a relationship type, completeness constraint on generalization.        Ans: Cardinality defines the number of entities to wh