-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOracle.sql
105 lines (91 loc) · 1.91 KB
/
Oracle.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
create table Users(
idUser varchar(10) primary key,
username varchar(250),
password varchar(250),
sexe varchar(2)
);
create table annexe(
idAnnexe varchar(10) primary key,
AnnexeValue varchar(150)
);
create table information(
idInformation varchar(10) primary key,
idAnnexe varchar(10),
infoValue varchar(10),
idUser varchar(10),
FOREIGN KEY(idUser) references Users(idUser),
FOREIGN KEY(idAnnexe) references annexe(idAnnexe)
);
create table Critere(
idCritere varchar(10) primary key,
idAnnexe varchar(10),
critValue varchar(10),
idUser varchar(10),
FOREIGN KEY(idUser) references Users(idUser),
FOREIGN KEY(idAnnexe) references annexe(idAnnexe)
);
insert into annexe values
( 'ANX0001' , 'Salaire' );
insert into annexe values
( 'ANX0002' , 'Nationalite' );
insert into annexe values
( 'ANX0003' , 'Finoana' );
insert into annexe values
( 'ANX0004' , 'Diplome' );
insert into annexe values
( 'ANX0005' , 'Longeur' );
insert into annexe values
( 'ANX0006' , 'Age' );
create table raikitra(
idRaikitra varchar(10) primary key,
idUser1 varchar(10),
idUser2 varchar(10),
dateRaikitra date,
Foreign key(idUser1) references Users(idUser),
Foreign key(idUser2) references Users(idUser)
);
create sequence idUser
start with 1
increment by 1
minvalue 1;
create function getIdUser()
returns int
language plpgsql
as
$$
Declare
id int;
BEGIN
return nextVal('idUser');
END;
$$;
create sequence idInformation
start with 1
increment by 1
minvalue 1;
create function getIdInformation()
returns int
language plpgsql
as
$$
Declare
id int;
BEGIN
return nextVal('idInformation');
END;
$$;
create sequence idCritere
start with 1
increment by 1
minvalue 1;
create function getIdCritere()
returns int
language plpgsql
as
$$
Declare
id int;
BEGIN
return nextVal('idCritere');
END;
$$;