This repository has been archived by the owner on Jun 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UPDATE.sql
70 lines (45 loc) · 2.02 KB
/
UPDATE.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
SELECT * FROM "Patient" p ;
DELETE FROM "Patient" p ;
ALTER TABLE "Patient"
ADD "Sexe" VARCHAR2(1) NOT NULL;
ALTER TABLE "Patient"
ADD "Email" VARCHAR2(255) NOT NULL;
ALTER TABLE "Patient"
ADD "Password" VARCHAR2(255) NOT NULL;
CREATE TABLE "Admin" (
"UserName" VARCHAR2(255) NOT NULL PRIMARY KEY, /*Have to be link with Email for the checking*/
"Prenom" VARCHAR2(255) NOT NULL,
"Nom" VARCHAR2(255) NOT NULL,
"Password" VARCHAR2(255) NOT NULL
);
SELECT * FROM "Admin" ;
SELECT * FROM "Profession" p ;
INSERT INTO "Admin" ("UserName","Prenom","Nom","Password") VALUES ('psy', 'Nicolas', 'Batardot','admin');
INSERT INTO "Profession" ("IDProfession","IDPatient","Profession" ) VALUES (prof_seq.NEXTVAL , 10, 'Cultivatrice');
/* Test Patient user */
CREATE USER test
IDENTIFIED BY patient
DEFAULT TABLESPACE Projet_bdd
QUOTA 20M on Projet_bdd;
GRANT create session TO test;
GRANT create VIEW TO test;
GRANT create USER TO psy;
CREATE USER "[email protected]" IDENTIFIED BY legalize DEFAULT TABLESPACE Projet_bdd QUOTA 20M on Projet_bdd;
GRANT create session TO "[email protected]";
ALTER TABLE "Consultation"
MODIFY "Prix" NUMBER NULL ;
ALTER TABLE "Consultation"
MODIFY "Reglement" VARCHAR2(255) NULL ;
SELECT * FROM "Consultation" c ;
DELETE FROM "PatientConsultant" WHERE "IDConsultation" =;
SELECT "DateRDV" FROM "Consultation" c INNER JOIN "PatientConsultant" pc ON c."IDConsultation" = pc."IDConsultation" INNER JOIN "Patient" p ON pc."IDPatient" = p.ID WHERE p."Email" = '[email protected]' ;
ALTER SESSION SET current_schema = PSY;
SELECT "DateRDV" FROM "Consultation" c INNER JOIN "PatientConsultant" pc ON c."IDConsultation" = pc."IDConsultation" INNER JOIN "Patient" p ON pc."IDPatient" = p.ID WHERE p."Email" = '[email protected]';
GRANT SELECT ON "Consultation" TO "[email protected]" ;
REVOKE
ALL PRIVILEGES
ON "Profession"
FROM "[email protected]";
SELECT "Email" FROM "Patient" p ;
INSERT TO "Consultation"
COMMIT;