-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDF_deVega_Estela.sql
2193 lines (1828 loc) · 98.8 KB
/
DF_deVega_Estela.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
/*REALIZADO POR : ESTELA DE VEGA 1ºDAM*/
/**************DISEÑO FISICO CUBE_X***********/
ALTER SESSION SET "_ORACLE_SCRIPT"=TRUE;
CREATE TABLESPACE CUBE_X
DATAFILE 'CUBEX.ORA' SIZE 300M;
CREATE USER cubeX IDENTIFIED BY IESRibera23
DEFAULT TABLESPACE CUBE_X;
GRANT DBA TO cubeX;
/*TABLAS*/
-- HE MODIFICADO LOS NOMBRES PARA EVITAR LAS PALABRAS RESERVADAS DE ORACLE
DROP TABLE CUBE_USERS CASCADE CONSTRAINTS;
CREATE TABLE CUBE_USERS (
ID_USER NUMBER(7) PRIMARY KEY,
NAME_USER VARCHAR2(45) UNIQUE NOT NULL,
PASSWORD_USER VARCHAR(45) NOT NULL,
/*EL NIVEL SE ESTABLECE EN 0, YA QUE PARA CALCULARLO NECESITAS EL ID DE TIME
PARA CALCULARLO. EL USUARIO AL ENTRAR TENDRA UN NIVEL 0, CUANDO HAYA REALIZADO
TIEMPOS SE IRAN ACTUALIZANDO EL NIVEL*/
LEVEL_USER NUMBER(4) DEFAULT 0 NOT NULL,
ROLE_USER VARCHAR2(6) NOT NULL CHECK (ROLE_USER IN ('MEMBER', 'USER')),
MAIL VARCHAR2(100) NOT NULL,
REGISTRATION_DATE DATE NOT NULL
);
INSERT INTO CUBE_USERS VALUES (1,'blue985', '3BlzY*8d#lB',0,'MEMBER',
'blue985@gmail.com',TO_DATE('02/01/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (2,'ElJoaki', '3KzY*8d#pR',0,'MEMBER',
'ElJoaki@gmail.com',TO_DATE('02/01/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (3,'AlexMx', 'm9MX5@Ls!2',0,'USER',
'AlexMx@gmail.com',TO_DATE('03/11/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (4,'Cubero89', '$tU7xVz#Pq',0,'MEMBER',
'Cubero89@gmail.com',TO_DATE('08/04/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (5,'SpeedCuber23', '6Rd@N$Z*2y',0,'USER',
'SpeedCuber23@gmail.com',TO_DATE('11/02/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (6,'RubikMaster', '@p7Dc$5A!z',0,'MEMBER',
'RubikMaster@gmail.com',TO_DATE('17/05/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (7,'QuickSolver', '2J!pT4$rFk',0,'MEMBER',
'QuickSolver@gmail.com',TO_DATE('21/01/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (8,'PuzzlePro','q3@v8XzA*k',0,'USER',
'PuzzlePro@gmail.com',TO_DATE('02/02/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (9,'CubeChamp','5Fb@P!z6Zr',0,'MEMBER',
'CubeChamp@gmail.com',TO_DATE('05/01/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (10,'TwistyWizard','y7A$k2T!fG',0,'USER',
'TwistyWizard@gmail.com',TO_DATE('10/02/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (11,'SolveGenius','H4*qA!z9dS',0,'USER',
'SolveGenius@gmail.com',TO_DATE('19/02/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (12,'CubeEnthusiast','z8P@5$S2Gj',0,'USER',
'CubeEnthusiast@gmail.com',TO_DATE('18/03/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (13,'FastFingers','!D5z9FGSr',0,'USER',
'FastFingers@gmail.com',TO_DATE('18/09/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (14,'PuzzleWhiz','K2D@j5PXWhr',0,'USER',
'PuzzleWhiz@gmail.com',TO_DATE('22/03/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (15,'SpeedySolver','qT3!F4p$z',0,'USER',
'SpeedySolver@gmail.com',TO_DATE('24/02/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (16,'PuzzleNinja','6k@2PNjG5mDz',0,'MEMBER',
'PuzzleNinja@gmail.com',TO_DATE('05/06/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (17,'QuickTwister','*J4s$2@8Np',0,'MEMBER',
'QuickTwister@gmail.com',TO_DATE('04/02/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (18,'NinjaRubik','$5Tq#4NrkjFz',0,'USER',
'NinjaRubik@gmail.com',TO_DATE('27/03/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (19,'CubingExpert','r7A$2pF!jT',0,'USER',
'CubingExpert@gmail.com',TO_DATE('30/03/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (20,'SpeedCubist','P5#mDzScbTQ!',0,'MEMBER',
'SpeedCubist@gmail.com',TO_DATE('14/03/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (21,'TwistyPro','f9@kD!p6sT',0,'MEMBER',
'TwistyPro@gmail.com',TO_DATE('25/12/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (22, 'CuberExtraordinaire', 'X9aPr@6g#fB', 0,
'USER', 'cuberExtraordinaire@gmail.com', TO_DATE('15/03/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (23, 'SpeedySolver17', '5GmHt*7s#iC', 0, 'USER',
'speedySolver17@gmail.com', TO_DATE('20/05/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (24, 'TwistyTornado', '2VnDy#9d@fL', 0, 'USER',
'twistyTornado@gmail.com', TO_DATE('10/06/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (25, 'PuzzleProdigy', '1IcKp@4o#tQ', 0, 'MEMBER',
'puzzleProdigy@gmail.com', TO_DATE('25/07/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (26, 'QuickCubeMaster', '9EsZw*3q#rD', 0, 'USER',
'quickCubeMaster@gmail.com', TO_DATE('05/08/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (27, 'RubikGenius99', '6UxYb@8a#nF', 0, 'USER',
'rubikGenius99@gmail.com', TO_DATE('18/09/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (28, 'FastFingerCuber', '4CjLr#5k@sH', 0, 'MEMBER',
'fastFingerCuber@gmail.com', TO_DATE('30/10/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (29, 'PuzzleWhisperer', '8JvOu*2p#bR', 0, 'USER',
'puzzleWhisperer@gmail.com', TO_DATE('12/11/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (30, 'AlgorithmArtist', '3DDDzY*8d#lB', 0, 'USER',
'algorithmArtist@gmail.com', TO_DATE('24/12/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (31, 'CubingSensation', '7XyFw@9v#mN', 0, 'USER',
'cubingSensation@gmail.com', TO_DATE('08/01/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (32, 'RapidRotation', '2PcJl#6b@sD', 0, 'MEMBER',
'rapidRotation@gmail.com', TO_DATE('15/02/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (33, 'SolveMaestro', '9EsZw*3q#rD', 0, 'MEMBER',
'solveMaestro@gmail.com', TO_DATE('25/03/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (34, 'TwistyTyphoon', '1IcKp@4o#tQ', 0, 'USER',
'twistyTyphoon@gmail.com', TO_DATE('05/04/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (35, 'PuzzlePhenom', '5GmHt*7s#iC', 0, 'USER',
'puzzlePhenom@gmail.com', TO_DATE('20/05/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (36, 'SpeedCubingGuru', '3BlzY*8d#lB', 0, 'USER',
'speedCubingGuru@gmail.com', TO_DATE('10/06/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (37, 'CubistChallenger', '6UxYb@8a#nF', 0, 'MEMBER',
'cubistChallenger@gmail.com', TO_DATE('25/07/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (38, 'RubikRiddler', '8JvOu*2p#bR', 0, 'USER',
'rubikRiddler@gmail.com', TO_DATE('05/08/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (39, 'QuickTwistExpert', '4CjLr#5k@sH', 0, 'USER',
'quickTwistExpert@gmail.com', TO_DATE('18/09/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (40, 'CubeConnoisseur', '7XyFw@9v#mN', 0, 'MEMBER',
'cubeConnoisseur@gmail.com', TO_DATE('30/10/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (41, 'TwistyTactician', '2PcJl#6b@sD', 0, 'USER',
'twistyTactician@gmail.com', TO_DATE('12/11/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (42, 'TwistyGuru', '3BlzY*8d#lB', 0, 'USER',
'twistyGuru@gmail.com', TO_DATE('24/12/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (43, 'CubingFanatic', '9EsZw*3q#rD', 0, 'MEMBER',
'cubingFanatic@gmail.com', TO_DATE('08/01/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (44, 'PuzzleMaestro', '1IcKp@4o#tQ', 0, 'MEMBER',
'puzzleMaestro@gmail.com', TO_DATE('15/02/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (45, 'RapidCuber', '5GmHt*7s#iC', 0, 'MEMBER',
'rapidCuber@gmail.com', TO_DATE('25/03/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (46, 'SolveSavvy', '3BlzY*8d#lB', 0, 'USER',
'solveSavvy@gmail.com', TO_DATE('05/04/2024', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (47, 'CubistChampion', '6UxYb@8a#nF', 0, 'MEMBER',
'cubistChampion@gmail.com', TO_DATE('20/05/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (48, 'RubikWhizKid', '8JvOu*2p#bR', 0, 'USER',
'rubikWhizKid@gmail.com', TO_DATE('10/06/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (49, 'AlgorithmAce', '4CjLr#5k@sH', 0, 'MEMBER',
'algorithmAce@gmail.com', TO_DATE('25/07/2023', 'DD/MM/YYYY'));
INSERT INTO CUBE_USERS VALUES (50, 'PuzzleSavant', '7XyFw@9v#mN', 0, 'MEMBER',
'puzzleSavant@gmail.com', TO_DATE('05/08/2023', 'DD/MM/YYYY'));
COMMIT;
DROP TABLE MEMBERS CASCADE CONSTRAINTS;
CREATE TABLE MEMBERS (
ID_USER NUMBER(7) PRIMARY KEY,
ID_MEMBER NUMBER(7) UNIQUE NOT NULL,
/*COMO SE CALCULA EL DESCUENTO A PARTIR DE LA FECHA EN QUE EL USUARIO
SE HIZO MIEMBRO, DAREMOS EL VALOR POR DEFECTO 0 Y LUEGO SE ACTUALIZARA*/
DISCOUNT NUMBER(3) DEFAULT 0 NOT NULL,
REGISTRATION_DATE DATE NOT NULL,
CONSTRAINT pk_member FOREIGN KEY (ID_USER) REFERENCES CUBE_USERS
ON DELETE CASCADE
);
INSERT INTO MEMBERS SELECT ID_USER,
-- HE INVESTIGADO EL COMO IMPLEMENTAR UN TIPO CONTADOR YA QUE EN ORACLE NO SE
-- PERMITEN ATRIBUTOS AUTOINCREMENT.
-- ESTA EXPRESION ASIGNA UN NUMERO UNICO A CADA FILA, ORDENANDOLAS SEGUN EL
-- ID_USER
ROW_NUMBER() OVER (ORDER BY ID_USER) AS ID_MEMBER,
0 AS DISCOUNT,
CASE
-- HE IMPLEMENTADO UN CASE PARA ASIGNAR LAS FECHAS ESPECIFICAS A CADA USUARIO
-- SEGUN SU POSICION EN LA SECUENCIA
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 1 THEN TO_DATE('02/02/2023', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 2 THEN TO_DATE('10/02/2023', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 3 THEN TO_DATE('08/05/2023', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 4 THEN TO_DATE('17/06/2023', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 5 THEN TO_DATE('14/03/2023', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 6 THEN TO_DATE('15/02/2024', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 7 THEN TO_DATE('27/06/2023', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 8 THEN TO_DATE('04/02/2023', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 9 THEN TO_DATE('20/03/2024', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 10 THEN TO_DATE('04/01/2024', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 11 THEN TO_DATE('04/08/2023', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 12 THEN TO_DATE('01/01/2024', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 13 THEN TO_DATE('16/02/2024', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 14 THEN TO_DATE('12/04/2024', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 15 THEN TO_DATE('31/08/2023', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 16 THEN TO_DATE('02/11/2023', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 17 THEN TO_DATE('22/02/2024', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 18 THEN TO_DATE('04/03/2024', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 19 THEN TO_DATE('11/04/2024', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 20 THEN TO_DATE('23/05/2023', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 21 THEN TO_DATE('09/08/2023', 'DD/MM/YYYY')
WHEN ROW_NUMBER() OVER (ORDER BY ID_USER) = 22 THEN TO_DATE('27/08/2023', 'DD/MM/YYYY')
END AS REGISTRATION_DATE
FROM CUBE_USERS
WHERE ROLE_USER LIKE 'MEMBER'
AND EXISTS (SELECT ID_USER FROM CUBE_USERS
WHERE ROLE_USER LIKE 'MEMBER');
COMMIT;
/*EL CALCULO DEL DESCUENTO PARA MIEMBROS SE BASA EN DESPUES DE 6 MESES LE DAN
UN DESCUENTO DE 10 EUROS PARA FUTURAS COMPETICIONES EXCLUSIVAS
SELECT ((DISCOUNT + 10) * TRUNC(MONTHS_BETWEEN(SYSDATE, REGISTRATION_DATE)/6)) AS TOTAL
FROM MEMBERS;*/
UPDATE MEMBERS
SET DISCOUNT = ((DISCOUNT + 10) * TRUNC(MONTHS_BETWEEN(SYSDATE, REGISTRATION_DATE)/6))
WHERE ID_MEMBER BETWEEN 1 AND 22;
DROP TABLE CUBE_TYPE CASCADE CONSTRAINTS;
CREATE TABLE CUBE_TYPE (
ID_TYPE NUMBER(3) PRIMARY KEY,
NAME_TYPE VARCHAR(55) UNIQUE NOT NULL
);
INSERT INTO CUBE_TYPE VALUES (1,'2x2x2');
INSERT INTO CUBE_TYPE VALUES (2,'3x3x3');
INSERT INTO CUBE_TYPE VALUES (3,'4x4x4');
INSERT INTO CUBE_TYPE VALUES (4,'5x5x5');
INSERT INTO CUBE_TYPE VALUES (5,'6x6x6');
INSERT INTO CUBE_TYPE VALUES (6,'7x7x7');
INSERT INTO CUBE_TYPE VALUES (7,'PYRAMINX');
INSERT INTO CUBE_TYPE VALUES (8,'MEGAMINX');
INSERT INTO CUBE_TYPE VALUES (9,'SKEWB');
INSERT INTO CUBE_TYPE VALUES (10,'SQUARE-1');
INSERT INTO CUBE_TYPE VALUES (11,'CLOCK');
INSERT INTO CUBE_TYPE VALUES (12,'3x3x3 MIRROR');
INSERT INTO CUBE_TYPE VALUES (13,'5x5x5 BLIND');
INSERT INTO CUBE_TYPE VALUES (14,'3x3x3 ONE-HANDED');
INSERT INTO CUBE_TYPE VALUES (15,'3x3x3 BLIND');
INSERT INTO CUBE_TYPE VALUES (16,'3x3x3 MULTIBLIND');
INSERT INTO CUBE_TYPE VALUES (17,'4x4x4 BLIND');
INSERT INTO CUBE_TYPE VALUES (18,'PYRAMORPHIX');
INSERT INTO CUBE_TYPE VALUES (19,'MASTERMORPHIX');
INSERT INTO CUBE_TYPE VALUES (20,'3x3x3 FEWEST MOVES CHALLENGE');
COMMIT;
DROP TABLE METHOD_CUBE CASCADE CONSTRAINTS;
CREATE TABLE METHOD_CUBE (
ID_METHOD NUMBER(3) PRIMARY KEY,
NAME_METHOD VARCHAR2(55) UNIQUE NOT NULL
);
INSERT INTO METHOD_CUBE VALUES (1,'ORTEGA METHOD');
INSERT INTO METHOD_CUBE VALUES (2,'CORNERS LAST LAYER');
INSERT INTO METHOD_CUBE VALUES (3,'BEGINNER�S METHOD');
INSERT INTO METHOD_CUBE VALUES (4,'REDUCED FRIDRICH METHOD');
INSERT INTO METHOD_CUBE VALUES (5,'FRIDRICH METHOD');
INSERT INTO METHOD_CUBE VALUES (6,'ROUX METHOD');
INSERT INTO METHOD_CUBE VALUES (7,'ZBOROWSKI-ZOLTE METHOD');
INSERT INTO METHOD_CUBE VALUES (8,'PETRUS METHOD');
INSERT INTO METHOD_CUBE VALUES (9,'WALTERMAN METHOD');
INSERT INTO METHOD_CUBE VALUES (10,'HEISE METHOD');
INSERT INTO METHOD_CUBE VALUES (11,'HOYA METHOD');
INSERT INTO METHOD_CUBE VALUES (12,'ZBOROWSKI-BRUCHEM LAST LAYER METHOD');
INSERT INTO METHOD_CUBE VALUES (13,'YAU METHOD');
INSERT INTO METHOD_CUBE VALUES (14,'INTUITIVE METHOD');
INSERT INTO METHOD_CUBE VALUES (15,'REDUX METHOD');
INSERT INTO METHOD_CUBE VALUES (16,'REDUCTION METHOD');
INSERT INTO METHOD_CUBE VALUES (17,'KEYHOLE METHOD');
INSERT INTO METHOD_CUBE VALUES (18,'LAYER-BY-LAYER METHOD');
INSERT INTO METHOD_CUBE VALUES (19,'RIDO METHOD');
INSERT INTO METHOD_CUBE VALUES (20,'EDGE PERMUTATION METHOD');
INSERT INTO METHOD_CUBE VALUES (21,'VANDENBERGH METHOD');
INSERT INTO METHOD_CUBE VALUES (22,'SHAPE-SHIFTING METHOD');
INSERT INTO METHOD_CUBE VALUES (23,'TOP-DOWN METHOD');
INSERT INTO METHOD_CUBE VALUES (24,'PATTERN METHOD');
INSERT INTO METHOD_CUBE VALUES (25,'OLD POCHMANN METHOD');
INSERT INTO METHOD_CUBE VALUES (26,'M2 METHOD');
INSERT INTO METHOD_CUBE VALUES (27,'CORNERS-FIRST METHOD');
INSERT INTO METHOD_CUBE VALUES (28,'GROUPING TECHNIQUE');
INSERT INTO METHOD_CUBE VALUES (29,'DIVIDE AND CONQUER APPROACH METHOD');
INSERT INTO METHOD_CUBE VALUES (30,'STARTING POSITION STRATEGY METHOD');
INSERT INTO METHOD_CUBE VALUES (31,'ADVANCED METHOD');
INSERT INTO METHOD_CUBE VALUES (32,'ADVANCED REDUCTION METHOD');
INSERT INTO METHOD_CUBE VALUES (33,'CENTERS SOLVING METHOD');
INSERT INTO METHOD_CUBE VALUES (34,'EDGE PAIRING TECHNIQUES');
INSERT INTO METHOD_CUBE VALUES (35,'BACKTRACKING TECHNIQUES');
INSERT INTO METHOD_CUBE VALUES (36,'EXHAUSTIVE SEARCH TECHNIQUES');
INSERT INTO METHOD_CUBE VALUES (37,'ALGORYTHM OPTIMIZATION TECHNIQUES');
INSERT INTO METHOD_CUBE VALUES (38,'MOVE ANALYSIS TECHNIQUES');
COMMIT;
-- HE RELACIONADO EL METODO CON EL TIPO DE CUBO
DROP TABLE TYPE_METHOD_TIENE CASCADE CONSTRAINTS;
CREATE TABLE TYPE_METHOD_TIENE(
ID_TYPE NUMBER(3) NOT NULL,
ID_METHOD NUMBER(3) NOT NULL,
CONSTRAINT pk_tiene_MeTy PRIMARY KEY (ID_TYPE, ID_METHOD),
CONSTRAINT fk_type_tiene FOREIGN KEY (ID_TYPE) REFERENCES CUBE_TYPE,
CONSTRAINT fk_method_tiene FOREIGN KEY (ID_METHOD) REFERENCES METHOD_CUBE
);
INSERT INTO TYPE_METHOD_TIENE VALUES (1, 1);
INSERT INTO TYPE_METHOD_TIENE VALUES (1, 2);
INSERT INTO TYPE_METHOD_TIENE VALUES (1, 3);
INSERT INTO TYPE_METHOD_TIENE VALUES (1, 4);
INSERT INTO TYPE_METHOD_TIENE VALUES (1, 5);
INSERT INTO TYPE_METHOD_TIENE VALUES (1, 14);
INSERT INTO TYPE_METHOD_TIENE VALUES (1, 18);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 3);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 4);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 5);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 6);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 7);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 8);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 9);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 10);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 11);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 12);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 13);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 14);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 15);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 16);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 17);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 18);
INSERT INTO TYPE_METHOD_TIENE VALUES (2, 20);
INSERT INTO TYPE_METHOD_TIENE VALUES (3, 3);
INSERT INTO TYPE_METHOD_TIENE VALUES (3, 4);
INSERT INTO TYPE_METHOD_TIENE VALUES (3, 5);
INSERT INTO TYPE_METHOD_TIENE VALUES (3, 6);
INSERT INTO TYPE_METHOD_TIENE VALUES (3, 8);
INSERT INTO TYPE_METHOD_TIENE VALUES (3, 10);
INSERT INTO TYPE_METHOD_TIENE VALUES (3, 16);
INSERT INTO TYPE_METHOD_TIENE VALUES (3, 18);
INSERT INTO TYPE_METHOD_TIENE VALUES (3, 19);
INSERT INTO TYPE_METHOD_TIENE VALUES (3, 24);
INSERT INTO TYPE_METHOD_TIENE VALUES (4, 3);
INSERT INTO TYPE_METHOD_TIENE VALUES (4, 4);
INSERT INTO TYPE_METHOD_TIENE VALUES (4, 5);
INSERT INTO TYPE_METHOD_TIENE VALUES (4, 6);
INSERT INTO TYPE_METHOD_TIENE VALUES (4, 8);
INSERT INTO TYPE_METHOD_TIENE VALUES (4, 10);
INSERT INTO TYPE_METHOD_TIENE VALUES (4, 16);
INSERT INTO TYPE_METHOD_TIENE VALUES (4, 18);
INSERT INTO TYPE_METHOD_TIENE VALUES (4, 21);
INSERT INTO TYPE_METHOD_TIENE VALUES (4, 22);
INSERT INTO TYPE_METHOD_TIENE VALUES (4, 24);
INSERT INTO TYPE_METHOD_TIENE VALUES (5, 3);
INSERT INTO TYPE_METHOD_TIENE VALUES (5, 4);
INSERT INTO TYPE_METHOD_TIENE VALUES (5, 5);
INSERT INTO TYPE_METHOD_TIENE VALUES (5, 13);
INSERT INTO TYPE_METHOD_TIENE VALUES (5, 16);
INSERT INTO TYPE_METHOD_TIENE VALUES (5, 18);
INSERT INTO TYPE_METHOD_TIENE VALUES (5, 23);
INSERT INTO TYPE_METHOD_TIENE VALUES (6, 3);
INSERT INTO TYPE_METHOD_TIENE VALUES (6, 4);
INSERT INTO TYPE_METHOD_TIENE VALUES (6, 5);
INSERT INTO TYPE_METHOD_TIENE VALUES (6, 13);
INSERT INTO TYPE_METHOD_TIENE VALUES (6, 16);
INSERT INTO TYPE_METHOD_TIENE VALUES (6, 18);
INSERT INTO TYPE_METHOD_TIENE VALUES (6, 23);
INSERT INTO TYPE_METHOD_TIENE VALUES (7, 3);
INSERT INTO TYPE_METHOD_TIENE VALUES (7, 14);
INSERT INTO TYPE_METHOD_TIENE VALUES (7, 18);
INSERT INTO TYPE_METHOD_TIENE VALUES (8, 3);
INSERT INTO TYPE_METHOD_TIENE VALUES (8, 8);
INSERT INTO TYPE_METHOD_TIENE VALUES (8, 14);
INSERT INTO TYPE_METHOD_TIENE VALUES (8, 16);
INSERT INTO TYPE_METHOD_TIENE VALUES (8, 18);
INSERT INTO TYPE_METHOD_TIENE VALUES (8, 22);
INSERT INTO TYPE_METHOD_TIENE VALUES (8, 24);
INSERT INTO TYPE_METHOD_TIENE VALUES (9, 3);
INSERT INTO TYPE_METHOD_TIENE VALUES (9, 14);
INSERT INTO TYPE_METHOD_TIENE VALUES (9, 18);
INSERT INTO TYPE_METHOD_TIENE VALUES (9, 24);
INSERT INTO TYPE_METHOD_TIENE VALUES (9, 31);
INSERT INTO TYPE_METHOD_TIENE VALUES (10, 3);
INSERT INTO TYPE_METHOD_TIENE VALUES (10, 14);
INSERT INTO TYPE_METHOD_TIENE VALUES (10, 18);
INSERT INTO TYPE_METHOD_TIENE VALUES (10, 22);
INSERT INTO TYPE_METHOD_TIENE VALUES (10, 24);
INSERT INTO TYPE_METHOD_TIENE VALUES (10, 31);
INSERT INTO TYPE_METHOD_TIENE VALUES (11, 14);
INSERT INTO TYPE_METHOD_TIENE VALUES (11, 24);
INSERT INTO TYPE_METHOD_TIENE VALUES (11, 28);
INSERT INTO TYPE_METHOD_TIENE VALUES (11, 29);
INSERT INTO TYPE_METHOD_TIENE VALUES (11, 30);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 3);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 4);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 5);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 6);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 7);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 8);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 9);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 10);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 11);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 12);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 13);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 14);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 15);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 16);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 17);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 18);
INSERT INTO TYPE_METHOD_TIENE VALUES (12, 20);
INSERT INTO TYPE_METHOD_TIENE VALUES (13, 13);
INSERT INTO TYPE_METHOD_TIENE VALUES (13, 14);
INSERT INTO TYPE_METHOD_TIENE VALUES (13, 15);
INSERT INTO TYPE_METHOD_TIENE VALUES (13, 32);
INSERT INTO TYPE_METHOD_TIENE VALUES (13, 33);
INSERT INTO TYPE_METHOD_TIENE VALUES (13, 34);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 3);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 4);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 5);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 6);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 7);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 8);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 9);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 10);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 11);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 12);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 13);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 14);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 15);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 16);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 17);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 18);
INSERT INTO TYPE_METHOD_TIENE VALUES (14, 20);
INSERT INTO TYPE_METHOD_TIENE VALUES (15, 3);
INSERT INTO TYPE_METHOD_TIENE VALUES (15, 4);
INSERT INTO TYPE_METHOD_TIENE VALUES (15, 5);
INSERT INTO TYPE_METHOD_TIENE VALUES (15, 6);
INSERT INTO TYPE_METHOD_TIENE VALUES (15, 7);
INSERT INTO TYPE_METHOD_TIENE VALUES (15, 8);
INSERT INTO TYPE_METHOD_TIENE VALUES (15, 9);
INSERT INTO TYPE_METHOD_TIENE VALUES (15, 10);
INSERT INTO TYPE_METHOD_TIENE VALUES (15, 11);
INSERT INTO TYPE_METHOD_TIENE VALUES (15, 12);
INSERT INTO TYPE_METHOD_TIENE VALUES (16, 15);
INSERT INTO TYPE_METHOD_TIENE VALUES (16, 23);
INSERT INTO TYPE_METHOD_TIENE VALUES (16, 25);
INSERT INTO TYPE_METHOD_TIENE VALUES (16, 26);
INSERT INTO TYPE_METHOD_TIENE VALUES (17, 13);
INSERT INTO TYPE_METHOD_TIENE VALUES (17, 14);
INSERT INTO TYPE_METHOD_TIENE VALUES (17, 15);
INSERT INTO TYPE_METHOD_TIENE VALUES (17, 32);
INSERT INTO TYPE_METHOD_TIENE VALUES (17, 33);
INSERT INTO TYPE_METHOD_TIENE VALUES (17, 34);
INSERT INTO TYPE_METHOD_TIENE VALUES (18, 14);
INSERT INTO TYPE_METHOD_TIENE VALUES (18, 18);
INSERT INTO TYPE_METHOD_TIENE VALUES (18, 24);
INSERT INTO TYPE_METHOD_TIENE VALUES (19, 14);
INSERT INTO TYPE_METHOD_TIENE VALUES (19, 16);
INSERT INTO TYPE_METHOD_TIENE VALUES (19, 18);
INSERT INTO TYPE_METHOD_TIENE VALUES (19, 24);
INSERT INTO TYPE_METHOD_TIENE VALUES (19, 28);
INSERT INTO TYPE_METHOD_TIENE VALUES (20, 28);
INSERT INTO TYPE_METHOD_TIENE VALUES (20, 34);
INSERT INTO TYPE_METHOD_TIENE VALUES (20, 36);
INSERT INTO TYPE_METHOD_TIENE VALUES (20, 37);
INSERT INTO TYPE_METHOD_TIENE VALUES (20, 38);
COMMIT;
DROP TABLE SESSIONS CASCADE CONSTRAINTS;
CREATE TABLE SESSIONS (
ID_SESSION NUMBER(7) PRIMARY KEY,
ID_USER NUMBER(7) NOT NULL,
NAME_SESSION VARCHAR2(45) NOT NULL,
CREATION_DATE DATE NOT NULL,
CONSTRAINT fk_user_session FOREIGN KEY (ID_USER) REFERENCES CUBE_USERS(ID_USER),
-- ESTABLEZCO EL NOMBRE DE LA SESSION SIN EL UNIQUE PARA QUE OTRO USUARIO
-- PUEDA TENER EL MISMO NOMBRE DE LA SESION QUE OTRO, PERO QUE UN USUARIO
-- NO PUEDA TENER UNA SESSION CON EL MISMO NOMBRE
CONSTRAINT UNIQUE_SESSION_NAME UNIQUE (NAME_SESSION, ID_USER)
);
INSERT INTO SESSIONS VALUES (301, 1, 'QUICK SOLVE SESSION',
TO_DATE('28/02/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (302, 3, 'FEWEST MOVES CHALLENGE',
TO_DATE('30/11/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (303, 7, 'FRIDRICH METHOD STRATEGIES',
TO_DATE('25/03/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (304, 4, 'ONE-HANDED CUBE PRACTICE',
TO_DATE('12/05/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (305, 10, 'MULTIBLIND SESSION',
TO_DATE('25/03/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (306, 14, '3x3 CUBE TOURNAMENT',
TO_DATE('30/03/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (307, 16, 'INTRODUCTION TO ORTEGA METHOD',
TO_DATE('11/07/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (308, 11, 'MIRROR CUBE SESSION',
TO_DATE('09/03/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (309, 1, 'BLINDFOLDED SOLVING TACTICS',
TO_DATE('04/01/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (310, 22, '4x4 CUBE SEMINAR',
TO_DATE('24/11/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (311, 19, '5x5 CUBE CHALLENGE',
TO_DATE('30/03/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (312, 27, 'PETRUS METHOD CLASS',
TO_DATE('17/12/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (313, 34, 'PYRAMINX SESSION',
TO_DATE('01/05/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (314, 35, 'STRATEGIES FOR 6x6 CUBES',
TO_DATE('12/07/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (315, 26, 'MEGAMINX SESSION',
TO_DATE('14/09/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (316, 33, '7x7 CUBE MARATHON',
TO_DATE('25/03/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (317, 17, 'LEARNING ROUX METHOD',
TO_DATE('12/11/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (318, 49, 'SKEWB CUBE CHALLENGE',
TO_DATE('03/07/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (319, 28, 'CLOCK CUBE SESSION',
TO_DATE('31/12/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (320, 47, 'MASTERMORPHIX PRACTICE',
TO_DATE('01/06/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (321, 12, 'EXPLORING YAU METHOD',
TO_DATE('18/03/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (322, 32, 'PYRAMORPHIX CHALLENGE',
TO_DATE('28/02/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (323, 1, 'REDUCED CUBES SESSION',
TO_DATE('09/03/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (324, 44, 'REVOLUTION CUBE PRACTICE',
TO_DATE('28/02/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (325, 39, 'REDUCTION CUBE TOURNAMENT',
TO_DATE('09/10/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (326, 22, 'FREEFORM CUBE SESSION',
TO_DATE('14/05/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (327, 21, 'VANDENBERGH CUBE MARATHON',
TO_DATE('01/01/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (328, 18, 'MIRROR CUBE STRATEGIES',
TO_DATE('28/03/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (329, 19, 'BLOCK SOLVING SESSION',
TO_DATE('30/03/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (330, 21, 'INTUITIVE METHODS SESSION',
TO_DATE('29/12/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (331, 35, 'ZBLL CUBE SESSION',
TO_DATE('06/06/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (332, 43, 'WALTERMAN CUBE CHALLENGE',
TO_DATE('11/02/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (333, 27, 'VANDENBERG ALGORITHM PRACTICE',
TO_DATE('19/10/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (334, 29, 'ADVANCED METHODS SESSION',
TO_DATE('12/01/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (335, 30, 'PATTERN RECOGNITION SESSION',
TO_DATE('28/02/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (336, 31, 'SPEED SOLVING SESSION',
TO_DATE('12/02/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (337, 42, 'ADVANCED CUBING TECHNIQUES',
TO_DATE('05/01/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (338, 7, 'TWISTY PUZZLE TACTICS',
TO_DATE('22/01/2023', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (339, 42, 'PUZZLE PERMUTATION SESSION',
TO_DATE('15/01/2024', 'DD/MM/YYYY'));
INSERT INTO SESSIONS VALUES (340, 11, 'CUBOID CHALLENGE SESSION',
TO_DATE('22/03/2024', 'DD/MM/YYYY'));
COMMIT;
DROP TABLE CHAMPIONSHIP CASCADE CONSTRAINTS;
CREATE TABLE CHAMPIONSHIP (
ID_CHAMP NUMBER(7) PRIMARY KEY,
-- A�ADO EL ID_USER DE QUIEN HA CREADO LA COMPETENCIA
ID_USER NUMBER(7) NOT NULL,
-- EL NOMBRE DE LA COMPETICION SE MODIFICA A UNIQUE PARA QUE NO HAYA UNA
-- COMPETICION CON EL MISMO NOMBRE
NAME_CHAMP VARCHAR2(45) UNIQUE NOT NULL,
-- POR DEFECTO EL PRECIO SE PONDRA EN 0
PRICE NUMBER(3) DEFAULT 0 NOT NULL,
NUMBER_PART NUMBER(7) NOT NULL CHECK (NUMBER_PART >= 2),
DESCRIPTION_CHAMP VARCHAR2(255) NOT NULL,
/*RESTRICCI�N PARA ASEGURAR QUE SOLO LOS MIEMBROS PUEDAN CREAR
COMPETICIONES EXCLUSIVAS PARA MIEMBROS CON PRECIOS*/
CONSTRAINT ch_price CHECK (PRICE = 0 OR ID_USER IN (1, 2, 4, 6, 7, 9, 16, 17,
20, 21, 25, 28, 32, 33, 37, 40, 43, 44, 45, 47, 49, 50)),
CONSTRAINT fk_user_champ FOREIGN KEY (ID_USER) REFERENCES CUBE_USERS
);
INSERT INTO CHAMPIONSHIP VALUES (121, 3, 'RUBIK�S CUBE CHAMPIONSHIP', 0,5,
'3x3x3 AND PYRAMINX CUBE CATEGORIES.');
INSERT INTO CHAMPIONSHIP VALUES (122, 2,'QUICK CUBING CLASH', 10, 4,
'3x3x3 BLIND, MEGAMINX AND PYRAMINX CUBE CATEGORIES.');
COMMIT;
/*MAS CAMPEONATOS EJEMPLOS:
INSERT INTO CHAMPIONSHIP VALUES (123, 5, 'CUBOFEST CHALLENGE', 0, 2,
'5x5x5 AND 3X3X3 BLIND CUBE CATEGORIES.');
INSERT INTO CHAMPIONSHIP VALUES (124, 42, 'CUBOMANIA MASTERS', 0, 3,
'7x7x7 CUBE CATEGORIES');
INSERT INTO CHAMPIONSHIP VALUES (125, 15, 'RUBIK�S RUMBLE ROYALE',0, 2,
'3x3x3 AND CLOCK CUBE CATEGORIES');
INSERT INTO CHAMPIONSHIP VALUES (126, 35, 'SPEEDCUBING SLAMDOWN', 0, 2,
'SKEWB AND 3x3x3 MIRROR CUBE CATEGORIES');
INSERT INTO CHAMPIONSHIP VALUES (127, 32, 'CUBEMASTER CHALLENGE', 15, 3,
'SQUARE-1 CUBE CATEGORY');
INSERT INTO CHAMPIONSHIP VALUES (128, 41, 'TWISTY PUZZLE TOURNAMENT', 0, 2,
'3x3x3 AND 3x3x3 MIRROR CUBE CATEGORIES');
INSERT INTO CHAMPIONSHIP VALUES (129, 24, 'CUBING CHAMPIONSHIP CLASH', 0, 3,
'4x4x4 BLIND CUBE CATEGORY');
INSERT INTO CHAMPIONSHIP VALUES (130, 35, 'RAPID RUBIK�S RACE', 0, 2,
'SKEWB, PYRAMINX CUBE CATEGORIES');
INSERT INTO CHAMPIONSHIP VALUES (131, 28, 'CUBEQUEST GRAND PRIX', 15, 2,
'2x2x2 AND 3x3x3 ONE-HANDED CUBE CATEGORIES');
INSERT INTO CHAMPIONSHIP VALUES (132, 46, 'SPEEDCUBE SPRINT SERIES', 0, 4,
'3x3x3 CUBE CATEGORY');
INSERT INTO CHAMPIONSHIP VALUES (133, 5, 'TWISTY TRIUMPH TOURNAMENT', 0, 2,
'3x3x3, AND 5x5x5 CUBE CATEGORIES');
INSERT INTO CHAMPIONSHIP VALUES (134, 2, 'CUBING CHALLENGE CHAMPIONSHIP', 20, 4,
'3x3x3 MULTIBLIND CUBE CATEGORIES');
INSERT INTO CHAMPIONSHIP VALUES (135, 11, 'RUBIK�S RACE ROYALE', 0, 4,
'2x2x2 CUBE CATEGORIES');
INSERT INTO CHAMPIONSHIP VALUES (136, 4, 'SPEEDCUBE SMASH', 19, 2,
'4x4x4 BLIND AND SKEWB CUBE CATEGORIES');*/
DROP TABLE CUBE_CHAMP_PERTENECE CASCADE CONSTRAINTS;
CREATE TABLE CUBE_CHAMP_PERTENECE(
ID_TYPE NUMBER(3) NOT NULL,
ID_CHAMP NUMBER(7) NOT NULL,
-- EN VEZ DE PONER EL GANADOR EN LA RELACION ENTRE EL USUARIO Y EL CAMPEONATO
-- LO ESTABLEZCO EN LA RELACION DEL TIPO DE CUBO Y EL CAMPEONATO, YA QUE EN
-- UN CAMPEONATO PUEDE HABER VARIAS CATEGORIAS Y VARIOS GANADORES
WINNER VARCHAR2(45),
CONSTRAINT pk_CubChaPertenece PRIMARY KEY (ID_TYPE, ID_CHAMP),
CONSTRAINT fk_type_pertenece FOREIGN KEY (ID_TYPE) REFERENCES CUBE_TYPE,
CONSTRAINT fk_champ_pertenece FOREIGN KEY (ID_CHAMP) REFERENCES CHAMPIONSHIP
);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (2, 121, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (7, 121, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (15, 122, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (8, 122, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (7, 122, null);
COMMIT;
/*DE LOS OTROS CAMPEONATOS DE EJEMPLOS:
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (4, 123, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (15, 123, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (6, 124, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (2, 125, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (11, 125, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (9, 126, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (12, 126, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (10, 127, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (2, 128, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (12, 128, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (17, 129, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (9, 130, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (7, 130, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (1, 131, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (14, 131, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (2, 132, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (2, 133, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (4, 133, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (16, 134, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (1, 135, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (17, 136, null);
INSERT INTO CUBE_CHAMP_PERTENECE VALUES (9, 136, null);*/
DROP TABLE USER_CHAMP_COMPETE CASCADE CONSTRAINTS;
CREATE TABLE USER_CHAMP_COMPETE(
ID_USER NUMBER(7) NOT NULL,
ID_CHAMP NUMBER(7) NOT NULL,
-- QUITO EL GANADOR
CONSTRAINT pk_compete PRIMARY KEY (ID_USER, ID_CHAMP),
/*RESTRICCI�N PARA ASEGURAR QUE SOLO LOS MIEMBROS PARTICIPEN EN
COMPETICIONES EXCLUSIVAS PARA MIEMBROS*/
CONSTRAINT ch_members CHECK (
(ID_CHAMP IN (122, 127, 131, 134, 136) AND ID_USER IN (1, 2, 4, 6, 7, 9, 16,
17, 20, 21, 25, 28, 32, 33, 37, 40, 43, 44, 45, 47, 49, 50)) OR
(ID_CHAMP NOT IN (122, 127, 131, 134, 136))),
CONSTRAINT fk_user_compete FOREIGN KEY (ID_USER) REFERENCES CUBE_USERS,
CONSTRAINT fk_champ_compete FOREIGN KEY (ID_CHAMP) REFERENCES CHAMPIONSHIP
);
INSERT INTO USER_CHAMP_COMPETE VALUES (3, 121);
INSERT INTO USER_CHAMP_COMPETE VALUES (20, 121);
INSERT INTO USER_CHAMP_COMPETE VALUES (41, 121);
INSERT INTO USER_CHAMP_COMPETE VALUES (17, 121);
INSERT INTO USER_CHAMP_COMPETE VALUES (21, 121);
INSERT INTO USER_CHAMP_COMPETE VALUES (32, 122); /*MEMBERS*/
INSERT INTO USER_CHAMP_COMPETE VALUES (37, 122);
INSERT INTO USER_CHAMP_COMPETE VALUES (7, 122);
INSERT INTO USER_CHAMP_COMPETE VALUES (6, 122);
COMMIT;
/*DE LOS OTROS CAMPEONATOS DE EJEMPLOS:
INSERT INTO USER_CHAMP_COMPETE VALUES (21, 123);
INSERT INTO USER_CHAMP_COMPETE VALUES (1, 123);
INSERT INTO USER_CHAMP_COMPETE VALUES (46, 124);
INSERT INTO USER_CHAMP_COMPETE VALUES (2, 124);
INSERT INTO USER_CHAMP_COMPETE VALUES (20, 124);
INSERT INTO USER_CHAMP_COMPETE VALUES (43, 125);
INSERT INTO USER_CHAMP_COMPETE VALUES (41, 125);
INSERT INTO USER_CHAMP_COMPETE VALUES (19, 126);
INSERT INTO USER_CHAMP_COMPETE VALUES (38, 126);
INSERT INTO USER_CHAMP_COMPETE VALUES (1, 127); MEMBERS
INSERT INTO USER_CHAMP_COMPETE VALUES (28, 127);
INSERT INTO USER_CHAMP_COMPETE VALUES (2, 127);
INSERT INTO USER_CHAMP_COMPETE VALUES (10, 128);
INSERT INTO USER_CHAMP_COMPETE VALUES (20, 128);
INSERT INTO USER_CHAMP_COMPETE VALUES (1, 129);
INSERT INTO USER_CHAMP_COMPETE VALUES (6, 129);
INSERT INTO USER_CHAMP_COMPETE VALUES (18, 129);
INSERT INTO USER_CHAMP_COMPETE VALUES (1, 130);
INSERT INTO USER_CHAMP_COMPETE VALUES (2, 130);
INSERT INTO USER_CHAMP_COMPETE VALUES (16, 131); MEMBERS
INSERT INTO USER_CHAMP_COMPETE VALUES (1, 131);
INSERT INTO USER_CHAMP_COMPETE VALUES (6, 131, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (4, 131, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (1, 131, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (7, 131, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (21, 131, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (33, 131, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (50, 131, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (2, 131, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (4, 132, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (8, 132, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (49, 132, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (16, 133, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (7, 133, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (24, 133, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (18, 133, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (2, 133, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (29, 133, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (25, 133, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (20, 134, null); MEMBERS
INSERT INTO USER_CHAMP_COMPETE VALUES (2, 134, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (16, 134, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (1, 134, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (17, 134, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (43, 134, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (6, 134, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (4, 134, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (25, 134, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (40, 135, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (3, 135, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (16, 135, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (35, 135, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (16, 136, null); MEMBERS
INSERT INTO USER_CHAMP_COMPETE VALUES (9, 136, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (2, 136, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (4, 136, null);
INSERT INTO USER_CHAMP_COMPETE VALUES (20, 136, null);*/
DROP TABLE COMPETITION CASCADE CONSTRAINTS;
CREATE TABLE COMPETITION(
ID_COMPE NUMBER(7) PRIMARY KEY,
ID_USER NUMBER(7) NOT NULL,
-- HE A�ADIDO DOS ATRIBUTOS PARA GUARDAR LOS NOMBRES DE LOS DOS COMPETIDORES
CUBER1 VARCHAR2(45) NOT NULL,
CUBER2 VARCHAR2(45) NOT NULL,
-- CAMBIO EL WINNER A NULL PARA PRIMERO CALCULAR LOS TIEMPOS Y SACAR EL MINIMO
WINNER VARCHAR2(45),
-- LOS COMMENTS Y LA DURACION PASAN A DECLARARSE EN LA TABLA SCRAMBLE
CONSTRAINT ch_NoEqualName CHECK (CUBER1 NOT LIKE CUBER2),
CONSTRAINT fk_user_compe FOREIGN KEY (ID_USER) REFERENCES CUBE_USERS
);
-- LOS NOMBRE DE LOS COMPETIDORES SERAN EL MISMO USUARIO Y OTRO NOMBRE DE OTRO
-- COMPETIDOR
INSERT INTO COMPETITION VALUES (220, 1,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 1), 'ElJoaki', null);
INSERT INTO COMPETITION VALUES (221, 3,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 3), 'FELIKS ZEMDEGS', null);
INSERT INTO COMPETITION VALUES (222, 1,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 1), 'MAX PARK', null);
INSERT INTO COMPETITION VALUES (223, 10,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 10), 'MATS VALK', null);
INSERT INTO COMPETITION VALUES (224, 11,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 11), 'SEUNGBEOM CHO (TYMON)', null);
INSERT INTO COMPETITION VALUES (225, 9,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 9), 'PATRICK PONCE', null);
INSERT INTO COMPETITION VALUES (226, 20,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 20), 'YUSHENG DU', null);
INSERT INTO COMPETITION VALUES (227, 20,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 20), 'PHILIPP WEYER', null);
INSERT INTO COMPETITION VALUES (228, 16,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 16), 'RAMI SBAHI', null);
INSERT INTO COMPETITION VALUES (229, 12,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 12), 'LUCAS ETTER', null);
INSERT INTO COMPETITION VALUES (230, 5,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 5), 'BILL WANG', null);
INSERT INTO COMPETITION VALUES (231, 6,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 6), 'DREW BRADS', null);
INSERT INTO COMPETITION VALUES (232, 5,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 5), 'KEVIN HAYS', null);
INSERT INTO COMPETITION VALUES (233, 2,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 2), 'ANTOINE CANTIN', null);
INSERT INTO COMPETITION VALUES (234, 1,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 1), 'MAX SIAUW', null);
INSERT INTO COMPETITION VALUES (235, 14,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 14), 'FELIKS ZEMDEGS', null);
INSERT INTO COMPETITION VALUES (236, 18,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 18), 'MAX PARK', null);
INSERT INTO COMPETITION VALUES (237, 19,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 19), 'MATS VALK', null);
INSERT INTO COMPETITION VALUES (238, 1,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 1), 'FELIKS ZEMDEGS', null);
INSERT INTO COMPETITION VALUES (239, 21,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 21), 'ElJoaki', null);
INSERT INTO COMPETITION VALUES (240, 9,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 9), 'FELIKS ZEMDEGS', null);
INSERT INTO COMPETITION VALUES (241, 22,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 22), 'SolveMaestro', null);
INSERT INTO COMPETITION VALUES (242, 25,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 25), 'TwistyTyphoon', null);
INSERT INTO COMPETITION VALUES (243, 34,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 34), 'MATS VALK', null);
INSERT INTO COMPETITION VALUES (244, 29,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 29), 'CubingFanatic', null);
INSERT INTO COMPETITION VALUES (245, 46,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 46), 'PuzzlePhenom', null);
INSERT INTO COMPETITION VALUES (246, 38,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 38), 'TwistyGuru', null);
INSERT INTO COMPETITION VALUES (247, 48,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 48), 'FELIKS ZEMDEGS', null);
INSERT INTO COMPETITION VALUES (248, 41,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 41), 'MAX PARK', null);
INSERT INTO COMPETITION VALUES (249, 35,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 35), 'PuzzleMaestro', null);
INSERT INTO COMPETITION VALUES (250, 42,
(SELECT NAME_USER FROM CUBE_USERS WHERE ID_USER = 42), 'SpeedCubingGuru', null);
COMMIT;
DROP TABLE AVERAGE CASCADE CONSTRAINTS;
CREATE TABLE AVERAGE (
ID_AVERAGE NUMBER(7) PRIMARY KEY,
-- ESTABLEZCO TODO EN NULL PARA LUEGO ACTUALIZARLES CON LOS VALORES
AVG_MINUTES NUMBER(2),
AVG_SECONDS DECIMAL(5, 3),
PERIOD_AVG NUMBER(3),
PB_MINUTES NUMBER(2),
PB_SECONDS DECIMAL(5, 3),
WORST_MINUTES NUMBER(2),
WORST_SECONDS DECIMAL(5, 3)
-- ELIMINO LA FECHA
);
INSERT INTO AVERAGE VALUES(1, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(2, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(3, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(4, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(5, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(6, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(7, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(8, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(9, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(10, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(11, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(12, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(13, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(14, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(15, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(16, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(17, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(18, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(19, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(20, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(21, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(22, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(23, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(24, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(25, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(26, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(27, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(28, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(29, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(30, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(31, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(32, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(33, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(34, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(35, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(36, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(37, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(38, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(39, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(40, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(41, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(42, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(43, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(44, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(45, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(46, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(47, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(48, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(49, null, null, null, null, null, null, null);
INSERT INTO AVERAGE VALUES(50, null, null, null, null, null, null, null);
COMMIT;
DROP TABLE SCRAMBLE CASCADE CONSTRAINTS;
CREATE TABLE SCRAMBLE (
ID_SCRAMBLE NUMBER(15) PRIMARY KEY,
ID_USER NUMBER(7) NOT NULL,
DESCRIPTION_SCRAMBLE VARCHAR2(455) UNIQUE NOT NULL,
MINUTES1 NUMBER(2) NOT NULL,
SECONDS1 DECIMAL(5, 3) NOT NULL,
MINUTES2 NUMBER(2),
SECONDS2 DECIMAL(5, 3),
-- HE ESTABLECIDO 2 COMMENTARIOS PARA CADA USUARIO, PARA DAR EL VALOR DE
-- +2 O DNF PARA MANEJAR MEJOR LOS TIEMPOS