Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Based on the relational schema (3NF), analyze the tables, their relationships, a

ID: 3725328 • Letter: B

Question

Based on the relational schema (3NF), analyze the tables, their relationships, and the sample data you were given. Create the tables shown, using the best data types based on your analysis. Follow each table name with an underscore and your first, middle, and last initials (if you do not have a middle initial, use X). For example, if your name is Alice B Chandler, you would name the Customer table Customer_abc. Also, keep in mind that foreign key relationships require the same data types on both sides (e.g., if you declare CustID as INTEGER in the Customer table, it must be declared as INTEGER in the Rental table, too). You must print a copy of each CREATE TABLE statement. In addition, execute a DESCRIBE statement for each table after it is created.

ResDetail Customer CustlD CustFName CustLName CustPhone CustType LoyaltylD Reservation ResID CheckinDate CheckOutDate CustID AgentID Room CustType CustType CustTypeDesc RoomNum RateType RateAmt RoomType Agent AgentlD AgentFName AgentLName AgentType RateType RateType RateTypeDesc RoomType RoomType RoomTypeDesc AgentType AgentType AgentTypeDesc

Explanation / Answer

create table CustType(

custtype varchar2(50),

custtypedesc varchar2(100),

primary key(custtype)

);

create table customer(

custid number,

custfname varchar2(100),

custlname varchar2(100),

custphone number,

custtype varchar2(50),

loyaltyid number,

primary key (custid),

foreign key (custtype) refrences CustType(custtype)

);

create table agenttype(

agenttype varchar2(100),

agentdesc varchar2(100),

primary key agenttype

);

create table agent(

agentid number,

agentfname varchar2(100),

agentlname varchar2(100),

agenttype varchar2(100),

primary key agentid,

foreign key agenttype refrences agenttype(agenttype)

);

create table Reservation(

resID number,

custid number,

checkindate date,

checkoutdate date,

agentid number,

primary key resid,

foreign key custid refrences customer(custid),

foreign key agentid refrences agent(agentid)

);

create table ratetype(

ratetype varchar2(100),

ratetypedec varchar2(200),

primary key ratetype

);

create table roomtype(

roomtype number,

roomtypedesc varchar2(100),

primary key (roomtype)

);

create table room(

roomnumber number,

roomtype varchar2(100),

prmary key roomnumber.

foreign key (roomtype) refrences roomtype(roomtype)

);

create table resdetail(

ratetype varchar2(100),

resid number,

rateamount number,

roomnumber number,

primary key (resid, roomnumber),

foreign key (ratetype) refrences ratetype(ratetype),

foreign key roomnumber refrences room(roomnumber)

);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote