Sunteți pe pagina 1din 8

CREAREA TABELELOR

1. Tabela Camere

create table CAMERE

NR_CAMERA NUMBER(2) not null,

TIP_CAMERA VARCHAR2(20),

PRET_NOAPTE NUMBER(6)

alter table CAMERE

add constraint NR_CAMERA_PK primary key (NR_CAMERA);

alter table CAMERE

add constraint PRET_NOAPTE_NN

check ("PRET_NOAPTE" IS NOT NULL);

2. Tabela Clienti

create table CLIENTI

ID_CLIENT NUMBER(6) not null,

NUME_CLIENT VARCHAR2(20),

PRENUME_CLIENT VARCHAR2(20),

TELEFON VARCHAR2(20),
CNP VARCHAR2(13),

EMAIL_CLIENT VARCHAR2(20)

alter table CLIENTI

add constraint ID_CLIENT_PK primary key (ID_CLIENT);

3. Tabela Departamente

create table DEPARTAMENTE

ID_DEPARTAMENT NUMBER(2) not null,

DEPARTAMENT VARCHAR2(20)

alter table DEPARTAMENTE

add constraint ID_DEPARTAMENT_PK primary key (ID_DEPARTAMENT);

4. Tabela Angajati
create table ANGAJATI

ID_ANGAJAT NUMBER(6) not null,

NUME VARCHAR2(20) NOT NULL,

PRENUME VARCHAR2(20) NOT NULL,


CNP VARCHAR2(13),

TELEFON VARCHAR2(20),

DATA_ANGAJARII DATE,

ID_FUNCTIE VARCHAR2(10),

SALARIU NUMBER(6),

ID_DEPARTAMENT NUMBER(2)

alter table ANGAJATI

add constraint ANG_ID_ANGAJAT_PK primary key (ID_ANGAJAT);

alter table ANGAJATI

add constraint ANG_DEPARTAMENT_FK foreign key (ID_DEPARTAMENT)

references DEPARTAMENTE (ID_DEPARTAMENT);

alter table ANGAJATI

add constraint ANG_CNP_UK unique (CNP);

alter table ANGAJATI

add constraint ANG_DATA_ANG_NN

check ("DATA_ANGAJARII" IS NOT NULL);

5. Tabela Facturi
create table FACTURI

NR_FACTURA NUMBER(6) not null,

DATA_FACTURA DATE,

DATA_CAZARE DATE,

NR_NOPTI NUMBER(2),
ID_CLIENT NUMBER(6),

NR_CAMERA NUMBER(2),

ID_ANGAJAT NUMBER(6)

alter table FACTURI

add constraint FACTURI_NR_FACTURA_PK primary key (NR_FACTURA);

alter table FACTURI

add constraint FACTURI_ID_CLIENT_FK foreign key (ID_CLIENT)

references CLIENTI (ID_CLIENT) on delete set null;

alter table FACTURI

add constraint FACTURI_ID_ANGAJAT_FK foreign key (ID_ANGAJAT)

references ANGAJATI (ID_ANGAJAT) on delete set null;

alter table FACTURI

add constraint FACTURI_DATA_NN

check ("DATA_FACTURA" IS NOT NULL);

create index FACTURI_DATA_IX on FACTURI (DATA_FACTURA);

create index FACTURI_ID_ANGAJAT_IX on FACTURI (ID_ANGAJAT);

create index FACTURI_ID_CLIENT_IX on FACTURI (ID_CLIENT);

6. Tabela Cheltuieli

create table CHELTUIELI

ID_CHElTUIELI NUMBER(6) not null,

DATA_PLATA DATE,
TIP_SERVICIU VARCHAR2(2),

VALOARE_SERVICIU NUMBER(6),

ID_DEPARTAMENT NUMBER(6),

ID_ANGAJAT NUMBER(6)

Adaugarea Inregistrarilor
TABELA CAMERE
INSERT INTO CAMERE(NR_CAMERA,TIP_CAMERA,PRET_NOAPTE)

VALUES (01,'SINGLE',100);

INSERT INTO CAMERE(NR_CAMERA,TIP_CAMERA,PRET_NOAPTE)

VALUES (02,'SINGLE',100);

INSERT INTO CAMERE(NR_CAMERA,TIP_CAMERA,PRET_NOAPTE)

VALUES (03,'SINGLE',100);

INSERT INTO CAMERE(NR_CAMERA,TIP_CAMERA,PRET_NOAPTE)

VALUES (04,'SINGLE',100);

INSERT INTO CAMERE(NR_CAMERA,TIP_CAMERA,PRET_NOAPTE)

VALUES (05,'SINGLE',100);

INSERT INTO CAMERE(NR_CAMERA,TIP_CAMERA,PRET_NOAPTE)


VALUES (06,'SINGLE',100);

INSERT INTO CAMERE(NR_CAMERA,TIP_CAMERA,PRET_NOAPTE)

VALUES (07,'DOUBLE',200);

INSERT INTO CAMERE(NR_CAMERA,TIP_CAMERA,PRET_NOAPTE)

VALUES (08,'DOUBLE',200);

INSERT INTO CAMERE(NR_CAMERA,TIP_CAMERA,PRET_NOAPTE)

VALUES (09,'SINGLE',100);

INSERT INTO CAMERE(NR_CAMERA,TIP_CAMERA,PRET_NOAPTE)

VALUES (10,'SINGLE',100);

TABELA CLIENTI

INSERT INTO
CLIENTI(ID_CLIENT,NUME_CLIENT,PRENUME_CLIENT,TELEFON,CNP,EMAIL_CLIENT)

VALUES (01,'MATEI','RUXANDRA','0723156840','2134154564392','mruxandra@gmail.com');

INSERT INTO
CLIENTI(ID_CLIENT,NUME_CLIENT,PRENUME_CLIENT,TELEFON,CNP,EMAIL_CLIENT)

VALUES (02,'LUNCASIU','BIANCA','0753124800','2134155564392','lunbianca@gmail.com');

INSERT INTO
CLIENTI(ID_CLIENT,NUME_CLIENT,PRENUME_CLIENT,TELEFON,CNP,EMAIL_CLIENT)

VALUES (03,'LAZAR','MARIA','0732126840','2234454564372','lazrmaria@gmail.com');
INSERT INTO
CLIENTI(ID_CLIENT,NUME_CLIENT,PRENUME_CLIENT,TELEFON,CNP,EMAIL_CLIENT)

VALUES (04,'MINCA','ANDREEA','0744126640','2154452564372','minandreea@gmail.com');

INSERT INTO
CLIENTI(ID_CLIENT,NUME_CLIENT,PRENUME_CLIENT,TELEFON,CNP,EMAIL_CLIENT)

VALUES (05,'MAZILU','RALUCA','0735126770','224425164312','mazraluca@gmail.com');

INSERT INTO
CLIENTI(ID_CLIENT,NUME_CLIENT,PRENUME_CLIENT,TELEFON,CNP,EMAIL_CLIENT)

VALUES (06,'MATARA','CATALINA','0752126750','2134450564392','mcatalina@gmail.com');

INSERT INTO
CLIENTI(ID_CLIENT,NUME_CLIENT,PRENUME_CLIENT,TELEFON,CNP,EMAIL_CLIENT)

VALUES (07,'MILU','CRISTINA','0770124540','2254454064312','mcristina@gmail.com');

INSERT INTO
CLIENTI(ID_CLIENT,NUME_CLIENT,PRENUME_CLIENT,TELEFON,CNP,EMAIL_CLIENT)

VALUES (08,'POPOVICI','DIANA','0725121820','2134584564302','pdiana@gmail.com');

INSERT INTO
CLIENTI(ID_CLIENT,NUME_CLIENT,PRENUME_CLIENT,TELEFON,CNP,EMAIL_CLIENT)

VALUES (09,'TANASE','MIRUNA','0752116240','22345154564372','tmiruna@gmail.com');

INSERT INTO
CLIENTI(ID_CLIENT,NUME_CLIENT,PRENUME_CLIENT,TELEFON,CNP,EMAIL_CLIENT)

VALUES (10,'LEOLEA','DARIE','0722126584','1234454564372','ldarie@gmail.com');
TABELA DEPARTAMENTE

INSERT INTO DEPARTAMENTE(ID_DEP,DEPARTAMENT)

VALUES (01,'RESTAURANT');

INSERT INTO DEPARTAMENTE(ID_DEP,DEPARTAMENT)

VALUES (02,'PARCARE');

INSERT INTO DEPARTAMENTE(ID_DEP,DEPARTAMENT)

VALUES (03,'ROOM-SERVICE');

INSERT INTO DEPARTAMENTE(ID_DEP,DEPARTAMENT)

VALUES (04,'FITNESS');

INSERT INTO DEPARTAMENTE(ID_DEP,DEPARTAMENT)

VALUES (05,'PAZA');