-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDATABASE_FINAL.sql
executable file
·2547 lines (2064 loc) · 90.8 KB
/
DATABASE_FINAL.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.5.9
-- Dumped by pg_dump version 9.5.9
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: peserta_ujian; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE peserta_ujian (
id_ujian character varying(40),
nobp character varying(15),
nm_mahasiswa character varying(100),
id_kelas integer,
nm_kelas character varying(10),
nilai integer,
status_ujian_peserta integer,
nm_status_ujian_peserta text
);
--
-- Name: gethasilujian(character varying); Type: FUNCTION; Schema: public; Owner: mandan
--
CREATE FUNCTION gethasilujian(v_id_ujian character varying) RETURNS SETOF peserta_ujian
LANGUAGE plpgsql
AS $$
BEGIN
RETURN QUERY select a.id_ujian,a.nobp,
a.nm_mahasiswa,
cast(a.id_kelas as integer),
a.nm_kelas,
cast((case when (b.nilai IS NULL) then 0 ELSE b.nilai END) as integer) as nilai,
cast((case when (b.nilai IS NULL) then
(CASE WHEN c.jawaban IS NULL THEN 3 ELSE 4 END)
ELSE 5 END) as integer) as status_ujian_peserta,
case when (b.nilai IS NULL) then
(CASE WHEN c.jawaban IS NULL THEN 'Belum Ujian' ELSE 'Periksa Jawaban' END)
ELSE 'Sudah Ujian' END as nm_status_ujian_peserta
from lap_peserta_ujian a
left join (select * from tbhasil_ujian aa where aa.id_ujian=v_id_ujian) b on a.nobp=b.nobp
left join (select aaa.id_ujian,aaa.nobp,aaa.jawaban from tbjawaban aaa where aaa.id_ujian = v_id_ujian) c on a.nobp=c.nobp
where a.id_ujian=v_id_ujian order by a.nm_kelas desc,a.nm_mahasiswa asc;
END; $$;
--
-- Name: tambahuserdosen(); Type: FUNCTION; Schema: public; Owner: mandan
--
CREATE FUNCTION tambahuserdosen() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
insert into tbuser(username,password,id_juser) select new.nidn as username,md5(CONCAT('upi',new.nidn,'yptk')) as password,2 as id_juser;
return new;
END;
$$;
--
-- Name: tambahusermahasiswa(); Type: FUNCTION; Schema: public; Owner: mandan
--
CREATE FUNCTION tambahusermahasiswa() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
insert into tbuser(username,password,id_juser) select new.nobp as username,md5(CONCAT('upi',new.nobp,'yptk')) as password,3 as id_juser;
return new;
END;
$$;
--
-- Name: updatestatuskuliah(); Type: FUNCTION; Schema: public; Owner: mandan
--
CREATE FUNCTION updatestatuskuliah() RETURNS trigger
LANGUAGE plpgsql
AS $$
begin
update tbkuliah set status_kuliah=1 where id_kuliah = new.id_kuliah;
return new;
end;
$$;
--
-- Name: updatestatusujian(); Type: FUNCTION; Schema: public; Owner: mandan
--
CREATE FUNCTION updatestatusujian() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
update tbujian set status_ujian=1 where id_ujian=new.id_ujian;
RETURN new;
END;
$$;
--
-- Name: tbjawaban_id_jawaban_seq; Type: SEQUENCE; Schema: public; Owner: mandan
--
CREATE SEQUENCE tbjawaban_id_jawaban_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: tbjawaban; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbjawaban (
id_jawaban integer DEFAULT nextval('tbjawaban_id_jawaban_seq'::regclass) NOT NULL,
id_ujian character varying(60) NOT NULL,
nobp character varying(15) NOT NULL,
jawaban text NOT NULL,
id_soal integer NOT NULL
);
--
-- Name: tbsoal_id_soal_seq; Type: SEQUENCE; Schema: public; Owner: mandan
--
CREATE SEQUENCE tbsoal_id_soal_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: tbsoal; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbsoal (
id_soal integer DEFAULT nextval('tbsoal_id_soal_seq'::regclass) NOT NULL,
isi_soal text NOT NULL,
"pilihanGanda" json,
id_jsoal smallint NOT NULL,
bobot smallint DEFAULT 1 NOT NULL,
jawaban character varying(5)
);
--
-- Name: lap_jawaban; Type: VIEW; Schema: public; Owner: mandan
--
CREATE VIEW lap_jawaban AS
SELECT tbjawaban.id_jawaban,
tbjawaban.nobp,
tbjawaban.id_ujian,
tbjawaban.id_soal,
tbsoal.isi_soal,
tbsoal.jawaban,
tbjawaban.jawaban AS jawaban_peserta,
tbsoal.bobot
FROM (tbjawaban
JOIN tbsoal ON ((tbjawaban.id_soal = tbsoal.id_soal)));
--
-- Name: tbnama_kelas_id_kelas_seq; Type: SEQUENCE; Schema: public; Owner: mandan
--
CREATE SEQUENCE tbnama_kelas_id_kelas_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: tbkelas; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbkelas (
id_kelas integer DEFAULT nextval('tbnama_kelas_id_kelas_seq'::regclass) NOT NULL,
nm_kelas character varying(10) NOT NULL
);
--
-- Name: tbkelas_ujian_id_kujian_seq; Type: SEQUENCE; Schema: public; Owner: mandan
--
CREATE SEQUENCE tbkelas_ujian_id_kujian_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: tbkelas_kuliah; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbkelas_kuliah (
id_kkuliah integer DEFAULT nextval('tbkelas_ujian_id_kujian_seq'::regclass) NOT NULL,
id_kuliah character varying(60) NOT NULL,
id_kelas integer NOT NULL
);
--
-- Name: lap_kelas_kuliah; Type: VIEW; Schema: public; Owner: mandan
--
CREATE VIEW lap_kelas_kuliah AS
SELECT a.id_kkuliah,
a.id_kelas,
a.id_kuliah,
b.nm_kelas
FROM (tbkelas_kuliah a
JOIN tbkelas b ON ((a.id_kelas = b.id_kelas)));
--
-- Name: tbdosen_id_dosen_seq; Type: SEQUENCE; Schema: public; Owner: mandan
--
CREATE SEQUENCE tbdosen_id_dosen_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: tbdosen; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbdosen (
id_dosen integer DEFAULT nextval('tbdosen_id_dosen_seq'::regclass) NOT NULL,
nm_dosen character varying(100) NOT NULL,
nidn character varying(15) NOT NULL,
status_dosen smallint DEFAULT 1 NOT NULL
);
--
-- Name: tbkuliah; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbkuliah (
id_kuliah character varying(40) NOT NULL,
nidn character varying(11) NOT NULL,
kd_matkul character varying(15) NOT NULL,
tahun_akademik character varying(5) NOT NULL,
status_kuliah smallint DEFAULT '0'::smallint NOT NULL
);
--
-- Name: tbmatkul_id_matkul_seq1; Type: SEQUENCE; Schema: public; Owner: mandan
--
CREATE SEQUENCE tbmatkul_id_matkul_seq1
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: tbmatkul; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbmatkul (
id_matkul integer DEFAULT nextval('tbmatkul_id_matkul_seq1'::regclass) NOT NULL,
kd_matkul character varying(15) NOT NULL,
nm_matkul character varying(100) NOT NULL,
sks smallint NOT NULL,
smt smallint NOT NULL,
status_matkul smallint DEFAULT 1 NOT NULL
);
--
-- Name: tbstatus_status_seq; Type: SEQUENCE; Schema: public; Owner: mandan
--
CREATE SEQUENCE tbstatus_status_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: tbstatus; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbstatus (
status integer DEFAULT nextval('tbstatus_status_seq'::regclass) NOT NULL,
nm_status character varying(20) NOT NULL
);
--
-- Name: lap_kuliah; Type: VIEW; Schema: public; Owner: mandan
--
CREATE VIEW lap_kuliah AS
SELECT a.id_kuliah,
a.kd_matkul,
b.nm_matkul,
a.nidn,
c.nm_dosen,
( SELECT array_agg(d_1.id_kelas) AS kelas
FROM (tbkelas_kuliah d_1
JOIN tbkelas e ON ((e.id_kelas = d_1.id_kelas)))
WHERE ((d_1.id_kuliah)::text = (a.id_kuliah)::text)) AS id_kelas,
( SELECT array_agg(e.nm_kelas) AS kelas
FROM (tbkelas_kuliah d_1
JOIN tbkelas e ON ((d_1.id_kelas = e.id_kelas)))
WHERE ((d_1.id_kuliah)::text = (a.id_kuliah)::text)) AS nm_kelas,
a.tahun_akademik,
a.status_kuliah,
d.nm_status AS nm_status_kuliah
FROM (((tbkuliah a
JOIN tbmatkul b ON (((a.kd_matkul)::text = (b.kd_matkul)::text)))
JOIN tbdosen c ON (((a.nidn)::text = (c.nidn)::text)))
JOIN tbstatus d ON ((a.status_kuliah = d.status)));
--
-- Name: tbmahasiswa_id_mahasiswa_seq; Type: SEQUENCE; Schema: public; Owner: mandan
--
CREATE SEQUENCE tbmahasiswa_id_mahasiswa_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: tbmahasiswa; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbmahasiswa (
id_mahasiswa integer DEFAULT nextval('tbmahasiswa_id_mahasiswa_seq'::regclass) NOT NULL,
nm_mahasiswa character varying(100) NOT NULL,
nobp character varying(15) NOT NULL,
status_mahasiswa smallint DEFAULT 1 NOT NULL
);
--
-- Name: tbpeserta_kuliah; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbpeserta_kuliah (
id_peserta character varying(60) NOT NULL,
nobp character varying(15) NOT NULL,
id_kuliah character varying(40) NOT NULL,
status_peserta smallint DEFAULT 1 NOT NULL,
status_kelas_peserta smallint DEFAULT '3'::smallint NOT NULL,
id_kelas integer DEFAULT 0 NOT NULL
);
--
-- Name: lap_peserta_kuliah; Type: VIEW; Schema: public; Owner: mandan
--
CREATE VIEW lap_peserta_kuliah AS
SELECT a.id_peserta,
b.id_kuliah,
b.kd_matkul,
b.nm_matkul,
b.nidn,
b.nm_dosen,
b.tahun_akademik,
a.nobp,
c.nm_mahasiswa,
a.status_peserta,
d.nm_status AS nm_status_peserta,
a.status_kelas_peserta,
e.nm_status AS nm_status_kelas_peserta,
a.id_kelas,
f.nm_kelas
FROM (((((tbpeserta_kuliah a
LEFT JOIN lap_kuliah b ON (((a.id_kuliah)::text = (b.id_kuliah)::text)))
JOIN tbmahasiswa c ON (((a.nobp)::text = (c.nobp)::text)))
JOIN tbstatus d ON ((a.status_peserta = d.status)))
JOIN tbstatus e ON ((a.status_kelas_peserta = e.status)))
JOIN tbkelas f ON ((a.id_kelas = f.id_kelas)));
--
-- Name: tbjenis_soal_id_jsoal_seq; Type: SEQUENCE; Schema: public; Owner: mandan
--
CREATE SEQUENCE tbjenis_soal_id_jsoal_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: tbjenis_soal; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbjenis_soal (
id_jsoal integer DEFAULT nextval('tbjenis_soal_id_jsoal_seq'::regclass) NOT NULL,
nm_jsoal character varying(20) NOT NULL
);
--
-- Name: tbjenis_ujian_id_jujian_seq; Type: SEQUENCE; Schema: public; Owner: mandan
--
CREATE SEQUENCE tbjenis_ujian_id_jujian_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: tbjenis_ujian; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbjenis_ujian (
id_jujian integer DEFAULT nextval('tbjenis_ujian_id_jujian_seq'::regclass) NOT NULL,
nm_jujian character varying(10) NOT NULL
);
--
-- Name: tbujian; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbujian (
id_ujian character varying(40) NOT NULL,
hari date NOT NULL,
mulai time without time zone NOT NULL,
selesai time without time zone NOT NULL,
deskripsi character varying(100) NOT NULL,
status_ujian smallint DEFAULT 0 NOT NULL,
id_jujian smallint NOT NULL,
id_jsoal smallint NOT NULL,
id_kuliah character varying(40) NOT NULL
);
--
-- Name: lap_ujian; Type: VIEW; Schema: public; Owner: mandan
--
CREATE VIEW lap_ujian AS
SELECT a.id_ujian,
a.hari,
a.mulai,
a.selesai,
a.deskripsi,
a.status_ujian,
c.nm_status AS nm_status_ujian,
a.id_jsoal,
d.nm_jsoal,
a.id_jujian,
e.nm_jujian,
b.id_kuliah,
b.kd_matkul,
b.nm_matkul,
b.nidn,
b.nm_dosen,
b.id_kelas,
b.nm_kelas,
b.tahun_akademik
FROM ((((tbujian a
JOIN lap_kuliah b ON (((a.id_kuliah)::text = (b.id_kuliah)::text)))
JOIN tbstatus c ON ((a.status_ujian = c.status)))
JOIN tbjenis_soal d ON ((a.id_jsoal = d.id_jsoal)))
JOIN tbjenis_ujian e ON ((a.id_jujian = e.id_jujian)));
--
-- Name: lap_peserta_ujian; Type: VIEW; Schema: public; Owner: mandan
--
CREATE VIEW lap_peserta_ujian AS
SELECT a.id_ujian,
a.hari,
a.mulai,
a.selesai,
a.deskripsi,
a.status_ujian,
a.nm_status_ujian,
a.id_jsoal,
a.nm_jsoal,
a.id_jujian,
a.nm_jujian,
a.kd_matkul,
a.nm_matkul,
a.nidn,
a.nm_dosen,
b.id_kuliah,
b.nobp,
b.nm_mahasiswa,
b.id_kelas,
b.nm_kelas,
concat(a.nm_matkul, '-', a.nm_jujian) AS nm_ujian
FROM (lap_ujian a
JOIN ( SELECT aa.id_kuliah,
aa.nobp,
bb.nm_mahasiswa,
aa.id_kelas,
cc.nm_kelas
FROM ((tbpeserta_kuliah aa
JOIN tbmahasiswa bb ON (((aa.nobp)::text = (bb.nobp)::text)))
JOIN tbkelas cc ON ((aa.id_kelas = cc.id_kelas)))) b ON (((a.id_kuliah)::text = (b.id_kuliah)::text)))
WHERE (a.status_ujian = 1);
--
-- Name: lap_soal; Type: VIEW; Schema: public; Owner: mandan
--
CREATE VIEW lap_soal AS
SELECT tbsoal.id_soal,
tbsoal.isi_soal,
tbsoal."pilihanGanda",
tbsoal.id_jsoal,
tbsoal.bobot,
tbsoal.jawaban,
tbjenis_soal.nm_jsoal
FROM (tbsoal
JOIN tbjenis_soal ON ((tbsoal.id_jsoal = tbjenis_soal.id_jsoal)));
--
-- Name: tbsoal_ujian_id_sujian_seq1; Type: SEQUENCE; Schema: public; Owner: mandan
--
CREATE SEQUENCE tbsoal_ujian_id_sujian_seq1
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: tbsoal_ujian; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbsoal_ujian (
id_sujian integer DEFAULT nextval('tbsoal_ujian_id_sujian_seq1'::regclass) NOT NULL,
id_ujian character varying(40) NOT NULL,
id_soal integer NOT NULL
);
--
-- Name: lap_soal_ujian; Type: VIEW; Schema: public; Owner: mandan
--
CREATE VIEW lap_soal_ujian AS
SELECT tbsoal_ujian.id_ujian,
tbsoal.id_soal,
tbsoal.isi_soal,
tbsoal."pilihanGanda",
tbsoal.id_jsoal,
tbsoal.bobot,
tbsoal.jawaban
FROM (tbsoal_ujian
JOIN tbsoal ON ((tbsoal_ujian.id_soal = tbsoal.id_soal)));
--
-- Name: tbjenis_user_id_juser_seq; Type: SEQUENCE; Schema: public; Owner: mandan
--
CREATE SEQUENCE tbjenis_user_id_juser_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: tbjenis_user; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbjenis_user (
id_juser integer DEFAULT nextval('tbjenis_user_id_juser_seq'::regclass) NOT NULL,
nm_juser character varying(20) NOT NULL
);
--
-- Name: tbuser_id_user_seq; Type: SEQUENCE; Schema: public; Owner: mandan
--
CREATE SEQUENCE tbuser_id_user_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: tbuser; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbuser (
id_user integer DEFAULT nextval('tbuser_id_user_seq'::regclass) NOT NULL,
username character varying(30) NOT NULL,
password text NOT NULL,
id_juser smallint NOT NULL,
status_user smallint DEFAULT 1 NOT NULL
);
--
-- Name: lap_user; Type: VIEW; Schema: public; Owner: mandan
--
CREATE VIEW lap_user AS
SELECT tbuser.id_user,
tbuser.username,
tbuser.password,
tbuser.id_juser,
tbjenis_user.nm_juser,
tbuser.status_user
FROM (tbuser
JOIN tbjenis_user ON ((tbuser.id_juser = tbjenis_user.id_juser)));
--
-- Name: tbhasil_ujian_id_hasil_seq; Type: SEQUENCE; Schema: public; Owner: mandan
--
CREATE SEQUENCE tbhasil_ujian_id_hasil_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: tbhasil_ujian; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbhasil_ujian (
id_hasil integer DEFAULT nextval('tbhasil_ujian_id_hasil_seq'::regclass) NOT NULL,
id_ujian character varying(40) NOT NULL,
nobp character varying(15) NOT NULL,
nilai smallint NOT NULL
);
--
-- Name: nilai_rata; Type: VIEW; Schema: public; Owner: mandan
--
CREATE VIEW nilai_rata AS
SELECT b.nm_dosen,
b.nm_matkul,
b.nm_jujian,
b.id_ujian,
(avg(b.nilai))::numeric(5,2) AS avg
FROM (tbpeserta_kuliah a
RIGHT JOIN ( SELECT aa.nobp,
aa.id_ujian,
bb.nm_matkul,
bb.nm_jujian,
bb.id_kuliah,
aa.nilai,
bb.nm_dosen
FROM (tbhasil_ujian aa
JOIN lap_ujian bb ON (((aa.id_ujian)::text = (bb.id_ujian)::text)))
ORDER BY bb.tahun_akademik, aa.nilai) b ON ((((a.id_kuliah)::text = (b.id_kuliah)::text) AND ((a.nobp)::text = (b.nobp)::text))))
GROUP BY b.id_ujian, b.nm_matkul, b.nm_jujian, b.nm_dosen;
--
-- Name: statistik; Type: VIEW; Schema: public; Owner: mandan
--
CREATE VIEW statistik AS
SELECT ( SELECT count(tbkuliah.id_kuliah) AS count
FROM tbkuliah) AS total_kuliah,
( SELECT count(tbujian.id_ujian) AS count
FROM tbujian) AS total_ujian,
( SELECT count(tbmahasiswa.id_mahasiswa) AS count
FROM tbmahasiswa) AS total_mahasiswa,
( SELECT count(tbdosen.id_dosen) AS count
FROM tbdosen) AS total_dosen;
--
-- Name: tbpengaturan; Type: TABLE; Schema: public; Owner: mandan
--
CREATE TABLE tbpengaturan (
pengaturan json
);
--
-- Data for Name: peserta_ujian; Type: TABLE DATA; Schema: public; Owner: mandan
--
COPY peserta_ujian (id_ujian, nobp, nm_mahasiswa, id_kelas, nm_kelas, nilai, status_ujian_peserta, nm_status_ujian_peserta) FROM stdin;
\.
--
-- Data for Name: tbdosen; Type: TABLE DATA; Schema: public; Owner: mandan
--
COPY tbdosen (id_dosen, nm_dosen, nidn, status_dosen) FROM stdin;
1 ANITA ADE RAHMA 1012019001 1
2 ARFIS 1009026602 1
3 AZIZUL HAKIM 1023116001 1
4 BUCHYARDI GOND 1025125401 1
5 DESFRIANA SARI 1028128901 1
6 DESI PERMATA SARI 1013128902 1
7 DESSY HARYANI 1029128101 1
8 DEVI EDRIANI 1027088001 1
9 DIAN MISRAWATI 1021118602 1
10 ELFA FITRIANI 1024089001 1
11 ELFISWANDI 1019046601 1
12 ELIZA 1016098104 1
13 FATMA ARIANI 1020059001 1
14 FITRI YENI 1012028201 1
15 HANNA PRATIWI 1022018601 1
16 HARMELIA 1001059002 1
17 HASMAYNELIS FITRI 1031057501 1
18 INDAH VIOZANI 1025069101 1
19 INDRA FAISAL 1025058801 1
20 LUSIANA 1015107601 1
21 MONDRA NELDI 1025027501 1
22 NITA SOFIA 1023098902 1
23 PRIMAROSI 1012018201 1
24 RIKA WAHYUNI 1007068502 1
25 RIRI PUTRI DIKA 1014048602 1
26 RONNI ANDRI WIJAYA 1011038501 1
27 SALMIDESTIAWAN 1030128501 1
28 SIGIT SANJAYA 1021078901 1
29 SONI 1027087801 1
30 TET LINDA YANI 1026128201 1
31 WELLIA NOVITA 1012118901 1
32 YAMASITHA 1004119001 1
33 YOSI YULIA 1017047602 1
34 YULIA SYAFITRI 1016078301 1
35 CENNYWATI 1024128201 1
36 DEFRIZAL SAPUTRA 1023128702 1
37 HARIS SATRIA 1009038901 1
38 IRNI RESMI APRIYANTI 1016048403 1
39 IRPAN SARIPUDIN 1015077903 1
40 MARIA MARGARETHA EARLENE 1025038701 1
41 RACHMAWATY 1019028401 1
42 TEGUH MEIRIZKY GIRDAYANTO 1001058204 1
43 YULIARMAN MAHMUDDIN 1016077202 1
44 ANDI B. WIRANATA 1025038501 1
45 ANDRE ILYAS 1009038301 1
46 ARIE YUSNELLY 1017068801 1
47 DARMA SYAHRULLAH EKA JAYA 1007098201 1
48 DASRIAL 1024086203 1
49 DASRIL MUNIR 1027125401 1
50 DICE DASRIL 1019038102 1
51 DIMAS PERDANA OSKAR 1012078502 1
52 ELVA SUSANTI 1012038303 1
53 EMILE SALIM 1010079101 1
54 ENGLA DESNIM SILVIA 1009128604 1
55 FITRAH SARI 1022118504 1
56 HADI IRFANI 1014018204 1
57 HERYATMAN 1022036901 1
58 HILDA MARY 1027088203 1
59 INDRIYENNI 1025056601 1
60 JON MAIZAR 1007018004 1
61 M. FADLI 1030098902 1
62 MARTA WIDIAN SARI 1020039001 1
63 MASRIFAH 303116303 1
64 MASRIZAL 1006088103 1
65 MAWARDI 1006095901 1
66 MERI MERIA SARI 1013029101 1
67 MEUTHI AN-NISA NOVIZAR 1017078906 1
68 MIRSAL 1004079001 1
69 NALIM 1001066001 1
70 NARDIMAN 1001018305 1
71 NILA PRATIWI 1001128601 1
72 R A APULIJAH ABUTOJO 324123401 1
73 RAMDANI BAYU PUTRA 1002117201 1
74 RANGGA WENDRA PRINOYA 1017128702 1
75 RINI AFRIANI 1008048803 1
76 RIO ANDHIKA PUTRA 1029038701 1
77 ROBBY DHARMA 1009038404 1
78 ROBERTA JULFA 1015108903 1
79 SASNELWATI 1024017001 1
80 SILVIA JESIKA 1027018901 1
81 SRI MONALISA 1029128503 1
82 SRI MULYATI 1004107101 1
83 SUHERMIZON 1005076403 1
84 SYAHNAN SIMATUPANG 1017066402 1
85 TIFANI RATU FIRDAUS 1013128901 1
86 TITIK EFNITA 1012039001 1
87 VICKY BRAHMA KUMBARA 1006108801 1
88 VIVI NILA SARI 1030118604 1
89 WINDA AFRIYENIS 1019048803 1
90 YEKI CANDRA 1019128204 1
91 YULASMI 1019087501 1
92 YULI ANGGRAINI 1013048204 1
93 ZAINAL ABDUL HARIS 1030087001 1
94 ZERNI MELMUSI 0011045604 1
95 AULIA FITRUL HADI 1017049101 1
96 DIYAWATI 1011087502 1
97 FENDI ANTONI 1015078501 1
98 HANGGI DWIFA HONESQI 1008018901 1
99 IDRIZON 1009117001 1
100 MAIDAWATI 1017047702 1
101 NOVALIA INDRA 1014019002 1
102 RIRY YUSKAR 1017047701 1
103 SILFIA ANDINI 1003056801 1
104 SULARNO 1016058902 1
105 SURMAYANTI 1029116801 1
106 VIVI RESTI DARMISON 1009128301 1
107 YOSEFRIZAL 1003077501 1
108 NURFITRI 1028048501 1
109 AMINDA DEWI SUTIASIH 1014039002 1
110 ANDRIYAS HARIYANDI 1020078401 1
111 DEVIT SATRIA 1024058901 1
112 DEWI DEVITA 1005019001 1
113 ILHAM TRI MAULANA 1017119002 1
114 INDRA WIJAYA 1025128401 1
115 IRNAWATI SIREGAR 1023016801 1
116 LAILA MARHAYATI 1031038803 1
117 LILI RISMAINI 1005058504 1
118 MEGAWATI 1003088802 1
119 MONICA FRANSISCA 1012019101 1
120 MUHARIKA DEWI 1031127801 1
121 NONI FEBRIANA 1019028801 1
122 POPI RADYULI 1003038901 1
123 RENNY PERMATA SAPUTRI 1014118801 1
124 RINI SEFRIANI 1008098501 1
125 SILVIA PERMATA SARI 1003088903 1
126 TAUFIK ADE KURNIAWAN 1009029001 1
127 YOSA NOVIA DEWI 1019018402 1
128 ZUBAIDAH 1009098901 1
129 ANDHIKA ANGGAWIRA 1024098002 1
130 ASIYARFITRIADI 1026078201 1
131 BAYU PRASETYA YUDHA 1018108501 1
132 DEVI PURNAMA SARI 1003098301 1