Question

In: Computer Science

Create a Database Schema for a hotel reservation system. indicate the Primary Keys, Foreign Keys, and...

Create a Database Schema for a hotel reservation system. indicate the Primary Keys, Foreign Keys, and the one-to-one or one-to-many relationships between the tables. Also describe in a small paragraph the scope of the back-end database, by explaining the different tables and their relations in your schema.

Solutions

Expert Solution

PK denotes the primary key while FK denotes the foreign key.

In model above , the main tables are: room, guest and reservation. Afterwards, we continue refining our tables by discovering their attributes or columns. Reservation table has attributes date_in, date_out, status (canceled, confirmed) and made_by (online, in_person, phone, mail), while the attributes of the table guest are: first_name, last_name and member_since.

Table room_reserved stores all rooms belonging to one reservation.

Moreover, as every reservation belongs to one guest, we need to create a new reference linking the guest and the reservation tables.

Move a column: Since we can have several rooms belonging to one reservation, we must allow cancelation per individual room, after that we move the attribute status from reservation to reserved_room table.

One point pending to be modeled is the fact that rooms can be in use by some guests for a period of time. To represent this business fact, we added 2 tables: hosted_at and occupied_room.

Note that every person who stayed at the hotel will have a record in hosted_at. This record will have a reference to the room he/she occupied and to the guest. This is why hosted_at has a double reference towards guest and occupied_room.

The table occupied_room will have one record per each room being rented, on this record we can find the fields: check_in and check_out of type timestamp indicating when the rent begin and finish. A timestamp data type stores a point in time with arbitrary precision. Every occupied_room record will also have a reference to the room number being rented and indirectly via hosted_at to the guests who stayed at this room.

We also added the table room_type to the data model; the idea is to group the rooms by room category or room type.


Related Solutions

Consider the following relational schema about a University (the primary keys are underlined and foreign keys...
Consider the following relational schema about a University (the primary keys are underlined and foreign keys are italic) STUDENT(StudentID, name, major, year, age) CLASS(ClassName, meetsAt, room, LecturerID) ENROLLED(StudentID, ClassName, mark) LECTURER(LecturerID, name, DepartmentID) DEPARTMENT(DepartmentID, name) Write the SQL statements for the following query: B1. Find the age of the oldest student. B2. Find the ID’s of lecturers whose name begins with “K” \ B3. Find the age of the youngest student who is enrolled in Mechatronics. B4. Find the age...
Please create the following tables for a tool rental database with appropriate primary keys & foreign...
Please create the following tables for a tool rental database with appropriate primary keys & foreign keys. Assumptions: 1. Each tool belongs to a category. 2. Each category may have a parent category but the parent category should not have a parent category (so at most two levels). E.g., a Tool A belongs to the electric mower, and electric mowers belong to mowers. Mower has no parent category. 3. Each tool can be rented at different time units. The typical...
Consider the following relational schema (the primary keys are underlined and foreign keys are italic) ITEM(ItemName,...
Consider the following relational schema (the primary keys are underlined and foreign keys are italic) ITEM(ItemName, ItemType, ItemColour) DEPARTMENT(Deptname, DeptFloor, DeptPhone, Manager) EMPLOYEE(EmpNo, EmpFname, EmpSalary, DeptName, SupervisedBy) SUPPLIER(SupNo, SupName) SALE(SaleNo, SaleQty, ItemName, DeptName) DELIVERY(DeliNo, DeliQty, ItemName, DeptName, SupNo) Write the SQL statements for the following queries: C1. Find the names of items sold on first and second floors. [1 mark] C2. For each department, list the department name and average salary of the employees where the average salary of the...
Q3. Convert the conceptual database into a relational database schema. Identify the primary key and foreign...
Q3. Convert the conceptual database into a relational database schema. Identify the primary key and foreign key constraints. Q4. Show all the functional dependencies that should hold among the attributes. Q5. Design relation schemas for the database that are each in 3NF. Specify the primary and foreign key attributes of each relation. Hi expert! Can you help me with the above questions? I'm not asking you to solve my questions but want to find what each questions actually requires me...
Database Design CIW State_Capitals Physical Database Create primary and secondary keys for the attached unfinished physical...
Database Design CIW State_Capitals Physical Database Create primary and secondary keys for the attached unfinished physical database design. CREATE DATABASE STATE_CAPITALS; GO USE STATE_CAPITALS; GO CREATE TABLE Country( Country_Code varchar(10) NOT NULL, Country_Name varchar(50) NOT NULL, Population int NOT NULL, Country_Size float NOT NULL ) GO CREATE TABLE Region( Country_Code varchar(10) NOT NULL, Region_Code varchar(10) NOT NULL, Region_Name varchar(50) NOT NULL ) GO CREATE TABLE State( Region_Code varchar(10) NOT NULL, State_Code char(2) NOT NULL, State_Name varchar(50) NOT NULL, Date_of_Statehood int...
Problem 1. Please create the following tables for a tool rental database with appropriate primary keys...
Problem 1. Please create the following tables for a tool rental database with appropriate primary keys & foreign keys. [30 points] Assumptions: Each tool belongs to a category. Each category may have a parent category but the parent category should not have parent category (so at most two levels). E.g., a Tool A belongs to electric mower, and electric mower belongs to mower. Mower has no parent category. Each tool can be rented at different time units. The typical time...
1. Discuss the elements of a database system. Like The database schema Schema objects Indexes Tables...
1. Discuss the elements of a database system. Like The database schema Schema objects Indexes Tables Fields and columns Records and rows Keys Relationships Data types 2. Discuss the key components of a database management system architecture and how they collaborate. 3. Discuss why a database management system needs a good query optimizer.
Star Inn is a chain of hotels. The reservation system is uses a centralized reservation database....
Star Inn is a chain of hotels. The reservation system is uses a centralized reservation database. The database contains booking information on all hotels of Star Inn. The following is a description of the conceptual model of the hotel reservation database at Star Inn. The database contains information about hotels, hotel rooms, customers, and reservation. A hotel can be identified by its identification number (hotel_id). It is also described by hotel_name, address and phone_no. Rooms are identified by room_no which...
1. Write CREAT TABLE statements for the following tables (primary keys are underlined, foreign keys are...
1. Write CREAT TABLE statements for the following tables (primary keys are underlined, foreign keys are in italic and bold). Make sure you have all needed constraints and appropriate datatypes for attributes: Student (stID, stName, dateOfBirth, advID, majorName, GPA) Advisor (advID, advName, specialty) 2.  Insert several records in each table.
1. Write CREAT TABLE statements for the following tables (primary keys are underlined, foreign keys are...
1. Write CREAT TABLE statements for the following tables (primary keys are underlined, foreign keys are in italic and bold). Make sure you have all needed constraints and appropriate datatypes for attributes: Student (stID, stName, dateOfBirth, advID, majorName, GPA) Advisor (advID, advName, specialty) 2. Insert several records in each table.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT