Maydon nomi
|
Tipi
|
Izoh
|
idemployee
|
int(6)
|
Kalit maydon
|
surname
|
varchar(50)
|
To’liq nomi
|
name
|
varchar(50)
|
Ismi
|
position
|
varchar(50)
|
Ishchi lavozimi
|
address
|
varchar(100)
|
Manzili
|
phone
|
varchar(20)
|
Telefon
|
email
|
varchar(50)
|
Elektron manzil
|
“sections” – bo'limlar haqida ma’lumotni saqlovchi jadval
Maydon nomi
|
Tipi
|
Izoh
|
idsection
|
int(5)
|
Kalit maydon
|
name
|
int(25)
|
Bo’lim nomi
|
address
|
varchar(50)
|
Bo’limning joylashish manzili
|
“leader” – boshliq haqida malumot saqlovchi jadval
Maydon nomi
|
Tipi
|
Izoh
|
idleader
|
int(5)
|
Kalit maydon
|
surname
|
varchar(50)
|
To’liq ismi
|
name
|
varchar(25)
|
Ismi
|
phone
|
varchar(20)
|
Telefon
|
email
|
varchar(30)
|
Kiritgan user
|
“ticket” – chipta haqidag ma’lumotni saqlovchi jadval
Maydon nomi
|
Tipi
|
Izoh
|
idticket
|
int(5)
|
Kalit maydon
|
price
|
int(20)
|
Chipta narxi
|
date
|
date(15)
|
Chipta sanasi
|
validity_period
|
varchar(20)
|
Amal qilish muddati
|
“advertising” – reklama malumotlarni saqlovchi jadval
Maydon nomi
|
Tipi
|
Izoh
|
idadvertising
|
int(4)
|
Kalit maydon
|
movie_title
|
varchar(40)
|
Film nomi
|
movie_date
|
date(20)
|
Film sanasi
|
“cash_register” – kalit maydon haqida ma’lumot saqlovchi jadval
Maydon nomi
|
Tipi
|
Izoh
|
idcash_register
|
int(5)
|
Kalit maydon
|
type_of_payment
|
varchar(20)
|
To’lov turi
|
“programm –saxna ko’rinishi namoyishi haqida ma’lumot saqlovchi jadval
Maydon nomi
|
Tipi
|
Izoh
|
idprogramm
|
int(10)
|
Kalit maydon
|
programm_time
|
date(20)
|
Namoyish vaqti
|
seans
|
varchar(40)
|
Namoyish
|
“theater” – teatr haqidagi ma’lumotlarni saqlovchi jadval
Maydon nomi
|
Tipi
|
Izoh
|
Idtheater
|
int(5)
|
Kalit maydon
|
Name
|
varchar(50)
|
Teatr nomi
|
Address
|
varchar(50)
|
Teatr manzili
|
Email
|
varchar(50)
|
Electron manzili
|
Phone
|
varchar(20)
|
Telefon
|
1.3.JADVALLARNING O’ZARO BOG’LANISHI
Theater va Section jadvallar 1:N bog’lanish turini hosil qilgan.
Employee va Section jadvallar 1:N bog’lanish turini hosil qilgan.
Leader va Sections jadvallar 1:1 bog’lanish turini hosil qilgan.
Theater va Programm jadvallar 1:N bog’lanish turini hosil qilgan.
Theater va Ticket jadvallar M:N bog’lanish turini hosil qilgan.
Theater va Advertising jadvallar 1:N bog’lanish turini hosil qilgan.
1.4.SQL operatorlari yordamida jadvallarni hosil qilish
va jadvallarga ma’lumotlar kiritish
jadval. “CASH_REGISTER” jadvalini CREATE operatori yordamida hosil qilish
CREATE TABLE CASH_REGISTER ( idCASH_REGISTER INT NOT NULL , TYPE_OF_PAYMENT VARCHAR(45) NULL , PRIMARY KEY (idCASH_REGISTER) )
jadval. “THEATER” jadvalini CREATE operatori yordamida hosil qilish
CREATE TABLE THEATER ( idTHEATER INT NOT NULL ,
THEATER_NAME VARCHAR(50) NULL , THEATER_ADDREES VARCHAR(55) NULL , THEATER_GMAIL VARCHAR(45) NULL , THEATER_PHONE_NUMBER INT(25) NULL, THEATERcol VARCHAR(45) NULL , CASH_REGISTER_idCASH_REGISTER INT NOT NULL , PRIMARY KEY (idTHEATER) ,
INDEX fk_THEATER_CASH_REGISTER1_idx (CASH_REGISTER_idCASH_REGISTER ASC) ,
CONSTRAINT fk_THEATER_CASH_REGISTER1 FOREIGN KEY (CASH_REGISTER_idCASH_REGISTER)
REFERENCES mydb.CASH_REGISTER (idCASH_REGISTER))
jadval. “SECTIONS” jadvalini CREATE operatori yordamida hosil qilish
CREATE TABLE SECTIONS ( idSECTIONS INT NOT NULL ,
SECTIONS_NAME VARCHAR(45) NULL , SECTIONS_ADDRESS VARCHAR(45) NULL , THEATER_idTHEATER INT NOT NULL ,
PRIMARY KEY (idSECTIONS, THEATER_idTHEATER) ,
INDEX fk_SECTIONS_THEATER1_idx (THEATER_idTHEATER ASC)
CONSTRAINT fk_SECTIONS_THEATER1
FOREIGN KEY (THEATER_idTHEATER) REFERENCES THEATER (idTHEATER)
4-jadval. “LEADER” jadvalini CREATE operatori yordamida hosil qilish
CREATE TABLE LEADER ( id_LEADER INT NOT NULL ,
LEADER_SURNAME VARCHAR(45) NULL , LEADER_NAME VARCHAR(45) NULL , LEADER_PHONE NUMBER VARCHAR(45) NULL , lLEADER_GMAIL VARCHAR(45) NULL , SECTIONS_idSECTIONS INT NOT NULL , SECTIONS_THEATER_idTHEATER INT NOT NULL , PRIMARY KEY (id_LEADER) ,
INDEX fk_LEADER_SECTIONS1_idx (SECTIONS_idSECTIONS ASC, SECTIONS_THEATER_idTHEATER ASC) ,
CONSTRAINT fk_LEADER_SECTIONS1 FOREIGN KEY (SECTIONS_idSECTIONS ,
SECTIONS_THEATER_idTHEATER)
REFERENCES mydb.SECTIONS (idSECTIONS , THEATER_idTHEATER)
5-jadval. “EMPLOYEE” jadvalini CREATE operatori yordamida hosil qilish
CREATE TABLE EMPLOYEE ( idEMPLOYEE INT NOT NULL ,
EMPLOYEE_SURNAME VARCHAR(45) NULL , EMPLOYEE_NAME VARCHAR(45) NULL , EMPLOYEE_POSITION VARCHAR(45) NULL ,
EMPLOYEE_ADDRESS VARCHAR(45) NULL , EMPLOYEE_PHONE NUMBER VARCHAR(45) NULL , EMPLOYEE_GMAIL VARCHAR(45) NULL , THEATER_idTHEATER INT NOT NULL , SECTIONS_idSECTIONS INT NOT NULL ,
PRIMARY KEY (idEMPLOYEE, THEATER_idTHEATER, SECTIONS_idSECTIONS) ,
INDEX fk_EMPLOYEE_THEATER_idx (THEATER_idTHEATER ASC)
,
INDEX fk_EMPLOYEE_SECTIONS1_idx (SECTIONS_idSECTIONS
ASC) ,
CONSTRAINT fk_EMPLOYEE_THEATER FOREIGN KEY (THEATER_idTHEATER) REFERENCES mydb.THEATER (idTHEATER) ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_EMPLOYEE_SECTIONS1 FOREIGN KEY (SECTIONS_idSECTIONS) REFERENCES mydb.SECTIONS (idSECTIONS) ON DELETE NO ACTION
ON UPDATE NO ACTION)
6-jadval. “PROGRAMM” jadvalini CREATE operatori yordamida hosil qilish
CREATE TABLE PROGRAMM ( idPROGRAMM INT NOT NULL , PROGRAMM_TIME VARCHAR(45) NULL , SEANS VARCHAR(45) NULL ,
THEATER_idTHEATER INT NOT NULL ,
PRIMARY KEY (idPROGRAMM, THEATER_idTHEATER) ,
INDEX fk_PROGRAMM_THEATER1_idx (THEATER_idTHEATER ASC) ,
CONSTRAINT fk_PROGRAMM_THEATER1 FOREIGN KEY (THEATER_idTHEATER)
7-jadval. “TICKET” jadvalini CREATE operatori yordamida hosil qilish
CREATE TABLE TICKET ( idTICKET INT NOT NULL , TICKET_PRICE INT NULL ,
TICKET_DATE VARCHAR(45) NULL , TICKET_VALIDITY_PERIOD VARCHAR(45) NULL , CASH_REGISTER_idCASH_REGISTER INT NOT NULL ,
PRIMARY KEY (idTICKET, CASH_REGISTER_idCASH_REGISTER) ,
INDEX fk_TICKET_CASH_REGISTER1_idx (CASH_REGISTER_idCASH_REGISTER ASC) ,
CONSTRAINT fk_TICKET_CASH_REGISTER1
FOREIGN KEY (CASH_REGISTER_idCASH_REGISTER) REFERENCES mydb.CASH_REGISTER (idCASH_REGISTER) ON DELETE NO ACTION
ON UPDATE NO ACTION)
8-jadval. “ADVERTISING” jadvalini CREATE operatori yordamida hosil qilish
CREATE TABLE ADVERTISING ( idADVERTISING INT NOT NULL , MOVIE_TITLE VARCHAR(45) NULL , MOVIE_DATE VARCHAR(45) NULL , THEATER_idTHEATER INT NOT NULL ,
PRIMARY KEY (idADVERTISING, THEATER_idTHEATER) ,
INDEX fk_ADVERTISING_THEATER1_idx (THEATER_idTHEATER ASC) ,
CONSTRAINT fk_ADVERTISING_THEATER1 FOREIGN KEY (THEATER_idTHEATER) REFERENCES mydb.THEATER (idTHEATER) ON DELETE NO ACTION ON UPDATE NO )
SQL operatorlari yordamida jadvallarga yozuvlar qo’shish
1-jadval. “Theater” jadvaliga INSERT operatori yordamida yozuv qo’shish
INSERT INTO Theater VALUES ('Alisher Navoiy nomidagi kinoteatr', 'Samarqand shahar Mirzo Ulugbek 15', ALisherKinoter@mail.ru', 915846532);
1-jadval. “Employee” jadvaliga INSERT operatori yordamida yozuv qo’shish
INSERT INTO Employee VALUES ('Alisher Naymanov’,’Alisher’, ’buxgalter’, 'Samarqand shahar Mirzo Ulugbek 15', 996584565 ,’ ALisherKinote@mail.rur',5);
jadval. “Programm” jadvaliga INSERT operatori yordamida yozuv qo’shish
INSERT INTO Programm VALUES (‘2021-12-02’,’Yozgi’ ,5);
2-jadval. “Section” jadvaliga INSERT operatori yordamida yozuv qo’shish
INSERT INTO Section VALUES (‘Kinolar’,’Mirzo Ulugbek’ ,6);
jadval. “Advertising” jadvaliga INSERT operatori yordamida yozuv qo’shish
INSERT INTO Advertising VALUES (‘Millionlar,’2021-12-12’ ,2);
jadval. “Leader” jadvaliga INSERT operatori yordamida yozuv qo’shish INSERT INTO Leader VALUES ('Alisher Naymanov’,’Alisher’, 996584578, ’ALisherKinote@mail.rur',5);
jadval. “Ticket” jadvaliga INSERT operatori yordamida yozuv qo’shish INSERT INTO Ticket VALUES (12000,’2021-02-05’, ’2021-02-25’,
’ALisherKinote@mail.rur',5);
jadval. “Cash_Register” jadvaliga INSERT operatori yordamida yozuv qo’shish
INSERT INTO Cash_Register VALUES (‘Online Click’);
Do'stlaringiz bilan baham: |