0% found this document useful (0 votes)
30 views2 pages

Print at

This document defines the schema for a student information database. It creates the database and defines several tables, including tables for counties, cities, students, courses, instructors, exams, and reservations. It also creates unique indexes on key fields for each table to enforce data integrity.

Uploaded by

Fabian Hall
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views2 pages

Print at

This document defines the schema for a student information database. It creates the database and defines several tables, including tables for counties, cities, students, courses, instructors, exams, and reservations. It also creates unique indexes on key fields for each table to enforce data integrity.

Uploaded by

Fabian Hall
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

CREATE DATABASE stusluImPr CHARACTER SET = 'utf8' COLLATE =

'utf8_croatian_ci';
USE stusluEM;
CREATE TABLE zupanija
( sifZupanija SMALLINT NT NULL
! nazZupanija NC"AR(#$% NT NULL
%;
CREATE UNI&UE INDE' zupanijaUni(u) N zupanija (sifZupanija%;

CREATE TABLE mj)st*
( p+r INTE,ER NT NULL
! nazMj)st* NC"AR(#$% NT NULL
! sifZupanija SMALLINT
%;
CREATE UNI&UE INDE' mj)st*P+r N mj)st* (p+r%;
CREATE INDE' mj)st*Uni(u) N mj)st* (nazMj)st*%;
CREATE TABLE stu-
( m+rStu- INTE,ER NT NULL
! im)Stu- NC"AR(./% NT NULL
! pr)zStu- NC"AR(./% NT NULL
! p+rR*- INTE,ER
! p+rStan INTE,ER NT NULL
! -atR*-Stu- DATE
, jmbgStud CHAR(13)
%;
CREATE UNI&UE INDE' stu-Uni(u) N stu- (m+rStu-%;
CREATE TABLE *r0j)-
( sifr0j)- INTE,ER NT NULL
! nazr0j)- NC"AR(1$% NT NULL
! sifNa-*r0j)- INTE,ER
%;
CREATE UNI&UE INDE' *r0j)-Uni(u) N *r0j)- (sifr0j)-%;
CREATE TABLE nasta2ni3
( sifNasta2ni3 INTE,ER NT NULL
! im)Nasta2ni3 NC"AR(./% NT NULL
! pr)zNasta2ni3 NC"AR(./% NT NULL
! p+rStan INTE,ER NT NULL
! sifr0j)- INTE,ER NT NULL
! 3*)f DECIMAL(4!.% NT NULL
%;
CREATE UNI&UE INDE' nasta2ni3Uni(u) N nasta2ni3
(sifNasta2ni3%;
CREATE TABLE pr)-
( sifPr)- INTE,ER NT NULL
! 3ratPr)- C"AR(5%
! nazPr)- NC"AR(1$% NT NULL
! sifr0j)- INTE,ER
! upisan*Stu- INTE,ER
! +r*jSatiTj)-n* INTE,ER
%;

CREATE UNI&UE INDE' pr)-Uni(u) N pr)- (sifPr)-%;
CREATE TABLE ispit
( m+rStu- INTE,ER NT NULL
! sifPr)- INTE,ER NT NULL
! sifNasta2ni3 INTE,ER NT NULL
! -atIspit DATE NT NULL
! *6j)na SMALLINT DE7AULT 8 NT NULL
%;
CREATE UNI&UE INDE' ispitUni(u) N ispit (m+rStu-! sifPr)-!
-atIspit%;

CREATE TABLE -2*rana
( *znD2*rana C"AR(/% NT NULL
! 3apa6it)t INTE,ER DE7AULT #$
%;
CREATE UNI&UE INDE' -2*ranaUni(u) N -2*rana (*znD2*rana%;
CREATE TABLE r)z)r2a6ija
( *znD2*rana C"AR(/% NT NULL
! *zn9rstaDan C"AR(.% NT NULL
! sat SMALLINT NT NULL
! sifPr)- INTE,ER NT NULL
%;

CREATE UNIQUE INDEX rezerva!jaU"!#ue $N rezerva!ja (%z"Dv%ra"a,
%z"&r'taDa", 'at)(

You might also like