In the context of the forum thread, what are the advantages and disadvantages of storing booking information separately from vehicle information in the database?

Storing booking information separately from vehicle information in the database can provide better organization and easier retrieval of data. However, it may require additional joins to fetch related information when needed, which can impact performance. To solve this issue, we can use a relational database design with proper indexing and efficient queries to minimize the performance impact.

// Example of storing booking information separately from vehicle information in the database

// Create a bookings table
CREATE TABLE bookings (
    id INT PRIMARY KEY,
    vehicle_id INT,
    booking_date DATE,
    customer_name VARCHAR(50)
);

// Create a vehicles table
CREATE TABLE vehicles (
    id INT PRIMARY KEY,
    make VARCHAR(50),
    model VARCHAR(50),
    year INT
);

// Query to fetch booking information with related vehicle information
SELECT b.id, b.booking_date, b.customer_name, v.make, v.model, v.year
FROM bookings b
JOIN vehicles v ON b.vehicle_id = v.id;