Knowee
Questions
Features
Study Tools

Charles is developing a travel booking system to manage customers, bookings, and payments. The system needs to handle three main types of data: CUSTOMERS, BOOKINGS, and PAYMENTS. To perform this the user needs to create the following tables with the mentioned constraints:

Question

Charles is developing a travel booking system to manage customers, bookings, and payments. The system needs to handle three main types of data: CUSTOMERS, BOOKINGS, and PAYMENTS. To perform this the user needs to create the following tables with the mentioned constraints:

🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, here's a step-by-step guide on how to create these tables:

  1. CUSTOMERS Table:

    This table will store all the customer related data. Here's a basic structure:

    CREATE TABLE CUSTOMERS (
        ID INT PRIMARY KEY,
        NAME VARCHAR(100),
        EMAIL VARCHAR(100),
        PHONE_NUMBER VARCHAR(15)
    );
    

    This creates a table named CUSTOMERS with four columns: ID, NAME, EMAIL, and PHONE_NUMBER. The ID is the primary key, which means it uniquely identifies each record in the table.

  2. BOOKINGS Table:

    This table will store all the booking related data. Here's a basic structure:

    CREATE TABLE BOOKINGS (
        ID INT PRIMARY KEY,
        CUSTOMER_ID INT,
        BOOKING_DATE DATE,
        DESTINATION VARCHAR(100),
        FOREIGN KEY (CUSTOMER_ID) REFERENCES CUSTOMERS(ID)
    );
    

    This creates a table named BOOKINGS with four columns: ID, CUSTOMER_ID, BOOKING_DATE, and DESTINATION. The ID is the primary key. The CUSTOMER_ID is a foreign key that references the ID in the CUSTOMERS table. This establishes a link between the two tables.

  3. PAYMENTS Table:

    This table will store all the payment related data. Here's a basic structure:

    CREATE TABLE PAYMENTS (
        ID INT PRIMARY KEY,
        BOOKING_ID INT,
        PAYMENT_DATE DATE,
        AMOUNT DECIMAL(10,2),
        FOREIGN KEY (BOOKING_ID) REFERENCES BOOKINGS(ID)
    );
    

    This creates a table named PAYMENTS with four columns: ID, BOOKING_ID, PAYMENT_DATE, and AMOUNT. The ID is the primary key. The BOOKING_ID is a foreign key that references the ID in the BOOKINGS table. This establishes a link between the two tables.

Please note that this is a basic structure. You might need to add more columns based on your specific requirements. Also, you might need to add more constraints to ensure the data integrity.

This problem has been solved

Similar Questions

Charles is developing a travel booking system to manage customers, bookings, and payments. The system needs to handle three main types of data: CUSTOMERS, BOOKINGS, and PAYMENTS. To perform this the user needs to create the following tables with the mentioned constraints: symbol refers to the primary key NN refers to Not NULL After creating the tables, Charles needs to:Alter the CUSTOMERS table to change the primary key to Email to ensure each customer is uniquely identified by their email address.Drop the primary key from the BOOKINGS table as it is no longer required.Note: The user must write only the query to create, alter, and drop the table. The query to display the description of the table is already given.Input format :No console inputOutput format :The output displays the successful table creation status and the structure of all three tablesRefer to the sample output.Sample test cases :Input 1 :Output 1 :Table CUSTOMERS created.Table BOOKINGS created.Table PAYMENTS created.Table CUSTOMERS altered.Table CUSTOMERS altered.Table BOOKINGS altered. Name Null? Type _____________ ___________ ________________ CUSTOMERID NOT NULL NUMBER FIRSTNAME VARCHAR2(100) LASTNAME VARCHAR2(100) EMAIL NOT NULL VARCHAR2(100) Name Null? Type ______________ ___________ ________________ BOOKINGID NOT NULL NUMBER CUSTOMERID NUMBER BOOKINGDATE DATE DESTINATION VARCHAR2(100) Name Null? Type ______________ ___________ _________ PAYMENTID NOT NULL NUMBER BOOKINGID NUMBER AMOUNT NUMBER PAYMENTDATE DATE TABLE_NAME COLUMN_NAME POSITION STATUS _____________ ______________ ___________ __________ CUSTOMERS EMAIL 1 ENABLED 1 row selected.

Alexander is developing a ride-sharing application to track drivers, vehicles, and trips. The system needs to handle three main types of data: DRIVERS, VEHICLES, and TRIPS. Write the DDL statements to create the following tables with the mentioned constraints to handle the data: The DRIVERS table has a named primary key constraint pk_driver.The VEHICLES table has a named primary key constraint pk_vehicle for VehicleID and a named foreign key constraint fk_driver for DriverID.The TRIPS table has a named primary key constraint pk_trip for TripID and a named foreign key constraint fk_vehicle for VehicleID.symbol refers to the primary key NN refers to Not NULLAlexander ensures the following constraints are altered:Remove the foreign key constraint named fk_driver from the VEHICLES table.Note: The user must write only the query to create and alter the table. The query to display the description of the table is already given.Input format :No console inputOutput format :The output displays the successful table creation status, the structure of all three tables, and the existing foreign key constraint details.Refer to the sample output.Sample test cases :Input 1 :Output 1 :Table DRIVERS created.Table VEHICLES created.Table TRIPS created.Table VEHICLES altered. Name Null? Type ________________ ___________ ________________ DRIVERID NOT NULL NUMBER NAME NOT NULL VARCHAR2(100) LICENSENUMBER NOT NULL VARCHAR2(20) Name Null? Type ____________ ___________ _______________ VEHICLEID NOT NULL NUMBER DRIVERID NOT NULL NUMBER MAKE NOT NULL VARCHAR2(50) MODEL NOT NULL VARCHAR2(50) Name Null? Type ____________ ___________ _________ TRIPID NOT NULL NUMBER VEHICLEID NOT NULL NUMBER TRIPDATE NOT NULL DATE DISTANCE NOT NULL NUMBER TABLE_NAME FOREIGN_KEY_NAME FOREIGN_KEY_COLUMN REFERENCED_CONSTRAINT_NAME REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME _____________ ___________________ _____________________ _____________________________ ________________________ _________________________ TRIPS FK_VEHICLE VEHICLEID PK_VEHICLE VEHICLES VEHICLEID 1 row selected. Note :The program will be evaluated only after the “Submit Code” is clicked.Extra spaces and new line characters in the program output will result in the failure of the test case.

Refer to the given schema. Write a query to create customer and branch tables with the constraints mentioned.

3.2. Tables: Considering the data points you listed, design a basic database schema with one main table (likely named "Expenses").Define the columns needed for this table.

The following tables form part of a database held in a relational DBMS:Hotel (hotelNo, hotelName, city)Room (roomNo, hotelNo, type, price)Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo)Guest (guestNo, guestName, guestAddress)where Hotel contains hotel details and hotelNo is the primary key;Room contains room details for each hotel and (roomNo, hoteINo) forms the primary key;Booking contains details of bookings and (hoteINo, guestNo, dateFrom) forms the primary key;Guest contains guest details and guestNo is the primary key.

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.