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...
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...
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...
• Relational Schema Create a relational database schema consisting of the four relation schemas representing various...
• Relational Schema Create a relational database schema consisting of the four relation schemas representing various entities recorded by a furniture company.   Write CREATE TABLE statements for the following four relation schemas. Define all necessary attributes, domains, and primary and foreign keys. Customer(CustomerID, Name, Address) FullOrder(OrderID, OrderDate, CustomerID) Request(OrderID, ProductID, Quantity) Product(ProductID, Description, Finish, Price) You should assume the following: Each CustomerID is a number with at most three digits, each OrderID is a number with at most five digits,...
In the world of database design and building it is very important to define Primary keys...
In the world of database design and building it is very important to define Primary keys in each table. The text this week talks about primary keys. What are they and why are they so important to a properly functioning database?
using c++ You have been contracted to build a hotel reservation system. This is the system...
using c++ You have been contracted to build a hotel reservation system. This is the system that hotel desk clerks will use to take desk reservations. Assumptions: This is acting as though the only reservations taken are at the desk. All reservations are for one night. The hotel is empty when you start the program. First, this program will give the full inventory of rooms in the hotel. Total rooms: 122 There are four types of rooms with these prices:...
Consider the following database schema: LIKE(person, sport), PRACTICE(person, sport), where person and sport are keys in...
Consider the following database schema: LIKE(person, sport), PRACTICE(person, sport), where person and sport are keys in both tables. The table LIKE gives the sports a person likes, the table PRACTICE gives the sports a person practices. We assume that a person likes at least one sport and practices at least one sport. We assume also that a person does not like a sport if the sport is not listed among the sports that person likes Express the following queries in...
Consider the following database schema: LIKE(person, sport), PRACTICE(person, sport), where person and sport are keys in...
Consider the following database schema: LIKE(person, sport), PRACTICE(person, sport), where person and sport are keys in both tables. The table LIKE gives the sports a person likes, the table PRACTICE gives the sports a person practices. We assume that a person likes at least one sport and practices at least one sport. We assume also that a person does not like a sport if the sport is not listed among the sports that a person likes Express the following queries...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT