Do’kon ijara Dokon ijarada biz 5 da jadval yaratdik


Download 1.03 Mb.
bet2/2
Sana02.01.2023
Hajmi1.03 Mb.
#1074989
1   2
Bog'liq
Saidmurodov Sulaymon 941 21-guruh

Avtotransport

Avtotransportning malumotlar bazasida biz 5 tajadval yaratdik
1. drivers haydovchilar ismi familiyasi vaqti tel raqami va email keltirilgan.
2. vehicles transport vositalari transport idsi uning modeli yili degan ustunlar qo’shdik.
3. routes mashrutlar transport vositalarini idsi joylashuvni boshlash va tugatish kabi ustunlarga ega.
4. passengers yo'lovchilar idsi ularning ismi familiyasi tel raqam va email kiritiladi.
5. tickets chiptalar chiptalar idsi va ularning narxlari berilgan.
CREATE DATABASE Motor_transport;
CREATE TABLE drivers (
id INT PRIMARY KEY AUTO_INCREMENT,
first_name VARCHAR(255) NOT NULL,
last_name VARCHAR(255) NOT NULL,
dob DATE NOT NULL,
gender CHAR(1) NOT NULL,
phone VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
address VARCHAR(255) NOT NULL
);
CREATE TABLE vehicles (
id INT PRIMARY KEY AUTO_INCREMENT,
driver_id INT NOT NULL,
make VARCHAR(255) NOT NULL,
model VARCHAR(255) NOT NULL,
year INT NOT NULL,
license_plate VARCHAR(255) NOT NULL,
FOREIGN KEY (driver_id) REFERENCES drivers(id)
);
CREATE TABLE routes (
id INT PRIMARY KEY AUTO_INCREMENT,
vehicle_id INT NOT NULL,
start_location VARCHAR(255) NOT NULL,
end_location VARCHAR(255) NOT NULL,
start_time TIME NOT NULL,
end_time TIME NOT NULL,
FOREIGN KEY (vehicle_id) REFERENCES vehicles(id)
);
CREATE TABLE passengers (
id INT PRIMARY KEY AUTO_INCREMENT,
first_name VARCHAR(255) NOT NULL,
last_name VARCHAR(255) NOT NULL,
dob DATE NOT NULL,
gender CHAR(1) NOT NULL,
phone VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
address VARCHAR(255) NOT NULL
);
CREATE TABLE passengers (
id INT PRIMARY KEY AUTO_INCREMENT,
first_name VARCHAR(255) NOT NULL,
last_name VARCHAR(255) NOT NULL,
dob DATE NOT NULL,
gender CHAR(1) NOT NULL,
phone VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
address VARCHAR(255) NOT NULL
);
CREATE TABLE tickets (
id INT PRIMARY KEY AUTO_INCREMENT,
passenger_id INT NOT NULL,
route_id INT NOT NULL,
price FLOAT NOT NULL,
FOREIGN KEY (passenger_id) REFERENCES passengers(id),
FOREIGN KEY (route_id) REFERENCES routes(id)
);
Download 1.03 Mb.

Do'stlaringiz bilan baham:
1   2




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling