LogicalPhysicalDesign: OPLMS--DML.sql

File OPLMS--DML.sql, 3.3 KB (added by 221296, 4 days ago)
Line 
1INSERT INTO users (first_name, last_name, email, password, role) VALUES
2('Ana', 'Adminova', 'ana.admin@oplms.com', 'pass123', 'ADMIN'),
3('Ivan', 'Instruktorov', 'ivan.instructor@oplms.com', 'pass123', 'INSTRUCTOR'),
4('Elena', 'Instruktorka', 'elena.instructor@oplms.com', 'pass123', 'INSTRUCTOR'),
5('Marko', 'Userov', 'marko.user@oplms.com', 'pass123', 'USER'),
6('Sara', 'Userova', 'sara.user@oplms.com', 'pass123', 'USER'),
7('Dalia', 'Userova', 'dalia.user@oplms.com', 'pass123', 'USER');
8
9
10INSERT INTO subscription_plan (name, price, duration_months, description, access_type) VALUES
11('Basic', 9.99, 1, 'Access to basic courses', 'BASIC'),
12('Pro', 19.99, 1, 'Access to all courses', 'FULL'),
13('Annual Pro', 199.99, 12, 'Full access for 12 months', 'FULL');
14
15
16INSERT INTO user_subscription (user_id, plan_id, start_date, end_date, status) VALUES
17(4, 2, '2025-12-01', '2025-12-31', 'ACTIVE'),
18(5, 1, '2025-12-05', '2026-01-05', 'ACTIVE');
19
20
21INSERT INTO payment (user_id, subscription_id, amount) VALUES
22(4, 1, 19.99),
23(5, 2, 9.99);
24
25
26INSERT INTO support_ticket (user_id, admin_id, subject, description, status)
27VALUES
28(4, 1, 'Payment issue', 'My payment shows pending.', 'OPEN'),
29(5, 1, 'Course access', 'I cannot access one course.', 'IN_PROGRESS');
30
31
32INSERT INTO category (name, description) VALUES
33('Programming', 'Programming related courses'),
34('Databases', 'SQL, relational design and normalization'),
35('Networks', 'Networking fundamentals and security');
36
37
38INSERT INTO course (name, price, status, instructor_id) VALUES
39('SQL Fundamentals', 0.00, 'ACTIVE', 2),
40('Database Design (ER -> Relational)', 29.99, 'ACTIVE', 2),
41('Network Security Basics', 19.99, 'ACTIVE', 3);
42
43
44INSERT INTO course_category (course_id, category_id) VALUES
45(1, 2),
46(2, 2),
47(3, 3);
48
49
50INSERT INTO module (course_id, title, description) VALUES
51(1, 'Intro to SQL', 'Basics of SELECT, WHERE, ORDER BY'),
52(1, 'Joins', 'INNER/LEFT JOIN and practice'),
53(2, 'ER Modeling', 'Entities, relationships, cardinalities'),
54(2, 'Relational Mapping', 'Transform ER to tables, PK/FK'),
55(3, 'Security Concepts', 'CIA, threats, authentication');
56
57
58INSERT INTO quiz (total_points, passing_score) VALUES
59(100, 60),
60(50, 30),
61(80, 50);
62
63
64INSERT INTO lesson (module_id, quiz_id, title, material) VALUES
65(1, 1, 'SQL SELECT basics', 'Intro material for SELECT'),
66(2, 1, 'JOIN examples', 'Practice joins with examples'),
67(3, 2, 'ER entities and attributes', 'How to identify entities'),
68(4, 2, 'Mapping rules', 'Rules for PK/FK and relations'),
69(5, 3, 'Security overview', 'Basic security principles');
70
71
72INSERT INTO enrollment (user_id, course_id, enroll_date, completion_status, progress_percentage) VALUES
73(4, 2, '2025-12-10', 'IN_PROGRESS', 70),
74(5, 1, '2025-12-12', 'IN_PROGRESS', 40);
75
76
77
78
79INSERT INTO quiz_attempt (user_id, quiz_id, score)
80VALUES (4, 2, 40);
81
82
83INSERT INTO quiz_attempt (user_id, quiz_id, score)
84VALUES (5, 1, 45);
85
86
87UPDATE enrollment
88SET completion_status = 'COMPLETED',
89 progress_percentage = 100
90WHERE enrollment_id = 1;
91
92UPDATE enrollment
93SET completion_status = 'IN_PROGRESS',
94 progress_percentage = 40
95WHERE enrollment_id = 2;
96
97
98INSERT INTO certificate (enrollment_id, issue_date, certificate_code, status)
99VALUES (1, '2025-12-20', 'CERT-DB-2025-0001', 'ISSUED');