2.2. Ma`lumotlar bazasini datalogik modeli
Ma`lumotlar bazasini quyida keltirilgan jadvallardan asosida shakllantiriladi.
Bu yerda jadvallarning tuzilishi, strukturasi va tasnifi keltirilgan
Ma`lumotlar bazasini datalogik modeli
bus_stations
Column
Type
Nu
ll
Defaul
t
Comments
idbus_ststions
int(5)
X
Name
int(50)
X
Leader
int(50)
X
phone_number
int(50)
X
Address
int(10
0)
X
cars
Column
Type
Null
Default
Comments
22
idcars
int(5)
X
car_model
varchar(50)
X
car_number
varchar(50)
X
car_color
varchar(50)
X
bus_stations_idbus_stations
int(5)
X
customers
Column
Type
Nu
ll
Defaul
t
Comments
idcustomers
int(5)
X
Family
int(50
)
X
Name
int(50
)
X
phone_number
int(50
)
X
Address
int(10
0)
X
cars_idcars
int(5)
X
cars_bus_stations_idbus_st
ations
int(5)
X
23
income_and_expenditure
Column
Тype
N
ull
Default
Comment
s
dincome_and_expenditur
e
int(5)
X
i_dream
Float
X
Expenses
Float
X
staff
Column
Тype
N
ull
Defaul
t
Comments
idstaff
int(5)
Н
ет
Leader
int(50)
Н
ет
Accountant
int(50)
Н
ет
the_guard
int(50)
Н
ет
bus_stations_idbus_stations
int(5)
Н
ет
ncome_and_expenditure_idi
ncome_and_expenditure
int(5)
Н
ет
24
1- rasm Loyihalashtirilayotgan ma`lumotlar bazasining
datalogik modeli
2.3 JADVALLARNING O’ZARO BOG’LANISHI
2-rasm cars va customers jadvallari 1:N bog’langan.
2-rasm cars va customers jadvallarining bo’lanishi .
25
3-rasm bus_stations va cars jadvallarining 1:N bog’lanishi .
4- rasm bus_stations va staff jadvallarining 1:N bog’lanishi .
26
5- rasm income_and_expenditure va staff jadvallarining 1:N bog’lanishi .
2.4 SQL operatorlari yordamida jadvallarni hosil qilish
va jadvallarga ma’lumotlar kiritish.
CREATE TABLE cars (idcars INT (5) NOT NULL PRIMARY KEY
AUTO_INCREMENT,
car_model VARCHAR(50) NOT NULL,
car_number VARCHAR(50) NOT NULL,
car_color VARCHAR(50) NOT NULL,
bus_stations_idbus_stations INT (5) NOT NULL);
INSERT INTO `cars`( `car_model`, `car_number`, `car_color`,
`bus_stations_idbus_stations`) VALUES ('GENTRA','30Z777ZZ','qora',1);
INSERT INTO `cars`( `car_model`, `car_number`, `car_color`,
`bus_stations_idbus_stations`) VALUES ('DAMAS','30A777BS',"ko'k",5);
INSERT INTO `cars`( `car_model`, `car_number`, `car_color`,
`bus_stations_idbus_stations`) VALUES ('NEXIA','30S777BF','oq',1);
INSERT INTO `cars`( `car_model`, `car_number`, `car_color`,
`bus_stations_idbus_stations`) VALUES ('COBALT','30A777MN','qizil',7);
INSERT INTO `cars`( `car_model`, `car_number`, `car_color`,
27
`bus_stations_idbus_stations`) VALUES ('NEXIA 3','30D777OP','sariq',6);
INSERT INTO `cars`( `car_model`, `car_number`, `car_color`,
`bus_stations_idbus_stations`) VALUES ('TURBO','30N777GT','qora',3);
INSERT INTO `cars`( `car_model`, `car_number`, `car_color`,
`bus_stations_idbus_stations`) VALUES ('NEXIA 2','30R777CF','oq',2);
INSERT INTO `cars`( `car_model`, `car_number`, `car_color`,
`bus_stations_idbus_stations`) VALUES ('COBALT','30Y777HY','qizil',9);
INSERT INTO `cars`( `car_model`, `car_number`, `car_color`,
`bus_stations_idbus_stations`) VALUES ('SPARK','30W777ZK','sariq',8);
INSERT INTO `cars`( `car_model`, `car_number`, `car_color`,
`bus_stations_idbus_stations`) VALUES ('MATIZ','30V777LJ','oq',4);
CREATE TABLE bus_stations(idbus_stations INT (5) NOT NULL
PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(50) NOT NULL,
leader VARCHAR(50) NOT NULL,
phone_number VARCHAR(50) NOT NULL,
address VARCHAR(45) NOT NULL);
INSERT INTO `bus_stations`( `name`, `leader`, `phone_number`, `address`)
VALUES ('Ishtixon avtostansiya','Bozorov D','+97 256 45 36','Ishtixon');
INSERT INTO `bus_stations`( `name`, `leader`, `phone_number`, `address`)
Do'stlaringiz bilan baham: |