0% found this document useful (0 votes)
3 views1 page

SQL Code

The document contains SQL code to create a database named 'parking_management' and three tables: 'ParkingSlots', 'Transactions', and 'Feedback'. The 'ParkingSlots' table tracks vehicle information and parking status, while the 'Transactions' table records entry and exit times along with payment details. The 'Feedback' table allows users to submit feedback related to their vehicle parking experience.

Uploaded by

okchintu832
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

SQL Code

The document contains SQL code to create a database named 'parking_management' and three tables: 'ParkingSlots', 'Transactions', and 'Feedback'. The 'ParkingSlots' table tracks vehicle information and parking status, while the 'Transactions' table records entry and exit times along with payment details. The 'Feedback' table allows users to submit feedback related to their vehicle parking experience.

Uploaded by

okchintu832
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

SQL code

-- Create the database


CREATE DATABASE IF NOT EXISTS parking_management;

-- Use the database


USE parking_management;

-- Create the ParkingSlots table


CREATE TABLE IF NOT EXISTS ParkingSlots (
slot_id INT AUTO_INCREMENT PRIMARY KEY,
vehicle_number VARCHAR(20) UNIQUE NOT NULL,
vehicle_type VARCHAR(20) NOT NULL,
is_parked BOOLEAN DEFAULT FALSE,
entry_time DATETIME,
exit_time DATETIME
);

-- Create the Transactions table


CREATE TABLE IF NOT EXISTS Transactions (
transaction_id INT AUTO_INCREMENT PRIMARY KEY,
vehicle_number VARCHAR(20) NOT NULL,
vehicle_type VARCHAR(20) NOT NULL,
entry_time DATETIME NOT NULL,
exit_time DATETIME NOT NULL,
amount DECIMAL(10, 2) NOT NULL,
FOREIGN KEY (vehicle_number) REFERENCES ParkingSlots(vehicle_number)
);

-- Create the Feedback table


CREATE TABLE IF NOT EXISTS Feedback (
feedback_id INT AUTO_INCREMENT PRIMARY KEY,
vehicle_number VARCHAR(20) NOT NULL,
feedback_text TEXT NOT NULL,
submitted_at DATETIME NOT NULL,
FOREIGN KEY (vehicle_number) REFERENCES ParkingSlots(vehicle_number)
);

You might also like