CREATE DATABASE Videoteka
GO
USE Videoteka
GO

CREATE TABLE Film
(	IDFilm		int		NOT NULL	PRIMARY KEY,
	TipMedija	nvarchar(10)	NOT NULL,
	Naziv		nvarchar(50)	NOT NULL,
	Trajanje	int		NOT NULL,
	Reziser		nvarchar(50),
	GlavniGlumac	nvarchar(50),
	SporedniGlumac	nvarchar(50),
	Zanar			nvarchar(10),
	KratkiOpis		nvarchar(max)
)
GO
CREATE TABLE Clan	
(	IDClana		int		NOT NULL	PRIMARY KEY,
	ImePrezime	nvarchar(50),
	Adresa		nvarchar(50),
	Telefon		nvarchar(20)
)
GO
CREATE TABLE Posudba
(	IDPosudbe  int NOT NULL IDENTITY (1,1) PRIMARY KEY ,
	FilmID		int	NOT NULL	FOREIGN KEY (FilmID) REFERENCES Film(IDFilm),
	ClanID		int NOT NULL	FOREIGN KEY	(ClanID) REFERENCES Clan(IDClana),
	DatumPosudbe	date,
	DatumVracanja	date
) 
GO