Create a table for database transformation , Database Management System

Assignment Help:

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.

STRUCTURE NOTES:

 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.


Related Discussions:- Create a table for database transformation

Advantages of data distribution, Advantages of Data Distribution The pr...

Advantages of Data Distribution The primary benefit of distributed database systems is the ability to access and share data in a reliable and efficient manner.

Represent the form as a relational schema, Question: This form represen...

Question: This form represents one of a number used for each sailing of a range of boats. A passenger may go on many sailings and will have the same passenger number for each.

What are the kinds of strings, What are the kinds of Strings?  -A binar...

What are the kinds of Strings?  -A binary string in MySQL is one that MySQL treats as case sensitive in comparisons. -A non binary string in MySQL is one that MySQL does'nt

What is hash file organization, What is hash file organization? What are t...

What is hash file organization? What are the causes of bucket overflow within a hash file organization? What can be completed to decrease the occurrence of bucket overflow?

Explain about data independence, Data Independence This brings us to ou...

Data Independence This brings us to our next topic: data independence. It is the property of the database which tries to make sure that if we make any change in any level of sc

What is the function of a domain, What is the function of a Domain? A d...

What is the function of a Domain? A domain defines the technical settings of a table field. A domain describes a value range, which sets the permissible data values for the

Unrepeatable reads-problems of concurrent transactions, Unrepeatable reads ...

Unrepeatable reads : Assume T7 reads X twice during its implementation. If it did not update X itself it could be very disturbing to see a dissimilar value of X in its next read. B

Define single valued and multivalued attributes, Define single valued and m...

Define single valued and multivalued attributes.  Single valued attributes: attributes with a single value for a particular entity are known as single valued attributes.   M

Describe in brief about object oriented design, Describe about Object orien...

Describe about Object oriented design Object oriented design is concerned with developing an object oriented model of a software system to implement known requirements. Many OO

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd