Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Create database kino
- use kino
- CREATE TABLE rzedy (
- id_rzedu INTEGER NOT NULL primary key identity(1,1),
- numer_rzedu INTEGER NOT NULL,
- );
- Insert Into rzedy values(1)
- Insert Into rzedy values(2)
- Insert Into rzedy values(3)
- Insert Into rzedy values(4)
- Insert Into rzedy values(5)
- Select * from rzedy
- CREATE TABLE miejsce (
- id_miejsca INTEGER NOT NULL primary key identity(1,1),
- numer_siedzenia INTEGER NOT NULL,
- );
- Insert Into miejsce values(1)
- Insert Into miejsce values(2)
- Insert Into miejsce values(3)
- Insert Into miejsce values(4)
- Insert Into miejsce values(5)
- Insert Into miejsce values(6)
- Insert Into miejsce values(7)
- Insert Into miejsce values(8)
- select * from miejsce
- CREATE TABLE rzedy_miejsce (
- id_rzad_miejsce INTEGER NOT NULL primary key identity(1,1),
- id_miejsca int foreign key references miejsce(id_miejsca),
- id_rzedu int foreign key references rzedy(id_rzedu),
- );
- Insert Into rzedy_miejsce values(1,1)
- Insert Into rzedy_miejsce values(1,2)
- Insert Into rzedy_miejsce values(3,1)
- Insert Into rzedy_miejsce values(1,5)
- select * from rzedy_miejsce
- CREATE TABLE sale (
- id_sala INTEGER NOT NULL primary key identity(1,1),
- nazwa_numer nvarchar(5)
- );
- Insert Into sale values('1A')
- Insert Into sale values('1B')
- Insert Into sale values('2A')
- Insert Into sale values('3C')
- CREATE TABLE miesjca_sale (
- id_miejsca_sale INTEGER NOT NULL primary key identity(1,1),
- id_rzad_miejsce int foreign key references rzedy_miejsce(id_rzad_miejsce),
- id_sala int foreign key references sale(id_sala),
- );
- Insert Into miesjca_sale values(1,1)
- Insert Into miesjca_sale values(2,1)
- Insert Into miesjca_sale values(2,2)
- Insert Into miesjca_sale values(3,4)
- Create TABLE ograniczenia_wiekowe (
- id_ograniczenie_wiekowe INTEGER NOT NULL primary key identity(1,1),
- nazwa nvarchar(30)
- );
- Insert Into ograniczenia_wiekowe values('pg 13')
- Insert Into ograniczenia_wiekowe values('r 16')
- Insert Into ograniczenia_wiekowe values('r 18')
- Insert Into ograniczenia_wiekowe values('pg 7')
- CREATE TABLE dubbing_napisy (
- id_dubbing_napisy INTEGER NOT NULL primary key identity(1,1),
- rodzaj nvarchar(30)
- );
- select* from ograniczenia_wiekowe
- Insert Into dubbing_napisy values('lektor')
- Insert Into dubbing_napisy values('dubbing')
- Insert Into dubbing_napisy values('napisy')
- select* from dubbing_napisy
- CREATE TABLE rodzaj_obrazu (
- id_rodzaj_obrazu INTEGER NOT NULL primary key identity(1,1),
- rodzaj nvarchar(7)
- );
- Insert Into rodzaj_obrazu values('2D')
- Insert Into rodzaj_obrazu values('3D')
- Select * from rodzaj_obrazu
- CREATE TABLE filmy (
- id_filmu INTEGER NOT NULL primary key identity(1,1),
- tytul nvarchar(50),
- rok_produkcji int,
- data_premiery datetime,
- czas_trwania nvarchar(7),
- opis nvarchar(300),
- id_ograniczenia_wiekowe int foreign key references ograniczenia_wiekowe(id_ograniczenie_wiekowe),
- );
- Insert Into filmy values('Avengers: End Game', 2019, '2019-04-25', '180min','Po wymazaniu połowy życia we Wszechświecie przez Thanosa, Avengersi starają się zrobić wszystko co konieczne, aby pokonać szalonego tytana. ',1)
- Select * from filmy
- CREATE TABLE gatunki(
- id_gatunki INTEGER NOT NULL primary key identity(1,1),
- gatunek nvarchar(30),
- );
- Insert Into gatunki Values('Fantasy')
- Insert Into gatunki Values('Akcja')
- Insert Into gatunki Values('Sci-fi')
- Insert Into gatunki Values('Dramat')
- Insert Into gatunki Values('Obyczajowy')
- Insert Into gatunki Values('Wojenny')
- CREATE TABLE filmy_gatunki (
- id_filmy_gatunki INTEGER NOT NULL primary key identity(1,1),
- id_gatunki int foreign key references gatunki(id_gatunki),
- id_filmu int foreign key references filmy(id_filmu)
- );
- Insert Into filmy_gatunki values(1,1)
- Insert Into filmy_gatunki values(3,1)
- Select * from filmy_gatunki
- CREATE TABLE seanse (
- id_seans INTEGER NOT NULL primary key identity(1,1),
- id_filmu int foreign key references filmy(id_filmu),
- id_sala int foreign key references sale(id_sala),
- id_rodzaj_obrazu int foreign key references rodzaj_obrazu(id_rodzaj_obrazu),
- id_dubbing_napisy int foreign key references dubbing_napisy(id_dubbing_napisy),
- data_seansu datetime
- );
- Insert Into seanse Values(1,1,1,1,'2019-04-25 15:30')
- Insert Into seanse Values(1,1,1,1,'2019-04-25 19:00')
- Insert Into seanse Values(1,1,1,1,'2019-04-25 22:30')
- Insert Into seanse Values(1,2,2,3,'2019-04-25 19:00')
- Insert Into seanse Values(1,1,1,2,'2019-04-25 22:30')
- Select * from seanse
- CREATE TABLE prac_stanowiska (
- id_prac_stanowiska INTEGER NOT NULL primary key identity(1,1),
- nazwa nvarchar(45)
- );
- Insert Into prac_stanowiska Values('kasjer')
- Insert Into prac_stanowiska Values('szef')
- Insert Into prac_stanowiska Values('administrator')
- CREATE TABLE dane_osobowe (
- id_dane_osobowe INTEGER NOT NULL primary key identity(1,1),
- imie nvarchar(45),
- nazwisko nvarchar(45),
- telefon int,
- data_urodzenia datetime,
- email nvarchar(45)
- );
- Insert into dane_osobowe Values('Kamil','Brzęczyszczykiewicz',501611422,'1997-01-24','kamil@gmail.com')
- Insert into dane_osobowe Values('Bogdan','Nowak',501611322,'1996-01-14','bogdan@gmail.com')
- Insert into dane_osobowe Values('Helena','Kowlaska',503631422,'1994-01-24','helena@gmail.com')
- Insert into dane_osobowe Values('Kezysztof','Bocian',601211422,'1989-02-24','krzys@gmail.com')
- Insert into dane_osobowe Values('Mieczysław','Gruzilica',301631522,'1987-03-24','mietek@gmail.com')
- CREATE TABLE pracownicy (
- id_pracownik INTEGER NOT NULL primary key identity(1,1),
- id_dane_osobowe int foreign key references dane_osobowe(id_dane_osobowe),
- data_zatrudnienia datetime Not Null,
- data_zwolnienia datetime,
- id_prac_stanowiska int foreign key references prac_stanowiska(id_prac_stanowiska)
- );
- Insert into pracownicy Values(5,'2015-03-23',Null,3)
- Insert into pracownicy Values(4,'2015-03-23',Null,1)
- Select do.imie from pracownicy as p join dane_osobowe as do on do.id_dane_osobowe = p.id_dane_osobowe
- CREATE TABLE klienci (
- id_klient INTEGER NOT NULL primary key identity(1,1),
- id_dane_osobowe int foreign key references dane_osobowe(id_dane_osobowe),
- );
- Insert Into klienci Values(1)
- Insert Into klienci Values(2)
- Insert Into klienci Values(3)
- CREATE TABLE rezerwacje (
- id_rezerwacja INTEGER NOT NULL primary key identity(1,1),
- id_seans int foreign key references seanse(id_seans),
- id_pracownik int foreign key references pracownicy(id_pracownik),
- id_klient int foreign key references klienci(id_klient),
- id_miejsca_sale int foreign key references miesjca_sale(id_miejsca_sale),
- data_zalozenia datetime
- );
- Insert Into rezerwacje Values(1,2,1,1,'2019-04-23')
- Insert Into rezerwacje Values(1,2,2,2,'2019-04-21')
- Insert Into rezerwacje Values(1,2,3,3,'2019-04-18')
- Select * from rezerwacje
- CREATE TABLE bilety (
- id_biletu INTEGER NOT NULL primary key identity(1,1),
- id_rezerwacja int foreign key references rezerwacje(id_rezerwacja),
- numer_biletu int,
- data_zakuput datetime,
- );
- Insert Into bilety values(1,0002,'2019-04-25')
- Insert Into bilety values(2,0003,'2019-04-25')
- Insert Into bilety values(1,0004,'2019-04-24')
- Select * from bilety
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement