Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
183 lines (144 loc) · 6.9 KB

File metadata and controls

executable file
·
183 lines (144 loc) · 6.9 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
DROP DATABASE IF EXISTS st_student;
CREATE DATABASE st_student DEFAULT CHARACTER SET 'utf8';
USE st_student;
create table st_group
(
group_id int unsigned not null auto_increment,
groupName varchar(255) not null,
curator varchar(255) not null,
speciality varchar(255) not null,
primary key (group_id)
) engine=InnoDB;
create table st_student
(
student_id int unsigned not null auto_increment,
firstName varchar(255) not null,
surName varchar(255) not null,
patronymic varchar(255) not null,
dateOfBirth date not null,
sex char(1),
group_id int unsigned not null,
educationYear int not null,
primary key (student_id)
) engine=InnoDB;
create table st_teacher
(
teacher_id int unsigned not null auto_increment,
firstName varchar(255) not null,
surName varchar(255) not null,
patronymic varchar(255) not null,
dateOfBirth date not null,
primary key (teacher_id)
) engine=InnoDB;
create table st_student_teacher
(
student_id int unsigned not null,
teacher_id int unsigned not null
) engine=InnoDB;
create index groupId on st_student(group_id);
alter table st_student add constraint refGroupId
foreign key (group_id)
references st_group(group_id);
create table st_person
(
person_id int unsigned not null auto_increment,
firstName varchar(255) not null,
surName varchar(255) not null,
patronymic varchar(255) not null,
primary key (person_id)
) engine=InnoDB;
create table st_company
(
company_id int unsigned not null auto_increment,
companyName varchar(255) not null,
primary key (company_id)
) engine=InnoDB;
create table st_account
(
account_id int unsigned not null auto_increment,
person_id int not null,
company_id int not null,
account_name varchar(100) not null,
primary key (account_id)
) engine=InnoDB;
create table st_account_firm
(
account_id int unsigned not null auto_increment,
company_from int not null,
company_to int not null,
account_name varchar(100) not null,
primary key (account_id)
) engine=InnoDB;
create table st_image
(
image_id int unsigned not null auto_increment,
image blob,
primary key (image_id)
) engine=InnoDB;
set names 'utf8';
insert into st_group (groupName, curator, speciality) values ('Ïåðâàÿ ãðóïïà', 'Äîêòîð Áîðìåíòàëü', 'Ïåðâàÿ ñïåöèàëüíîñòü');
insert into st_group (groupName, curator, speciality) values ('Âòîðàÿ ãðóïïà', 'Ïðîôåññîð Ïðåîáðàæåíñêèé', 'Âòîðàÿ ñïåöèàëüíîñòü');
insert into st_student (firstName, patronymic, surName, sex, dateOfBirth, group_id, educationYear)
values ('Èâàí', 'Ñåðãååâè÷', 'Ñòåïàíîâ', 'M', '1990-03-20', 1, 2006);
insert into st_student (firstName, patronymic, surName, sex, dateOfBirth, group_id, educationYear)
values ('Íàòàëüÿ', 'Àíäðååâíà', '×è÷èêîâà', 'F', '1990-06-10', 1, 2006);
insert into st_student (firstName, patronymic, surName, sex, dateOfBirth, group_id, educationYear)
values ('Âèêòîð', 'Ñèäîðîâè÷', 'Áåëîâ', 'M', '1990-01-10', 1, 2006);
insert into st_student (firstName, patronymic, surName, sex, dateOfBirth, group_id, educationYear)
values ('Ïåòð', 'Âèêòîðîâè÷', 'Øóøêèí', 'M', '1991-03-12', 2, 2006);
insert into st_student (firstName, patronymic, surName, sex, dateOfBirth, group_id, educationYear)
values ('Âåðîíèêà', 'Ñåðãååâíà', 'Êîâàëåâà', 'F', '1991-07-19', 2, 2006);
insert into st_student (firstName, patronymic, surName, sex, dateOfBirth, group_id, educationYear)
values ('Èðèíà', 'Ôåäîðîâíà', 'Èñòîìèíà', 'F', '1991-04-29', 2, 2006);
insert into st_teacher (firstName, patronymic, surName, dateOfBirth) values ('Ïðîõîð', 'Ïàôíóòüåâè÷', 'Øòåéåðìàí', '1962-07-01');
insert into st_teacher (firstName, patronymic, surName, dateOfBirth) values ('Àâãóñò', 'Ôåäîðîâè÷', 'Ãàãàðèí', '1955-11-23');
insert into st_teacher (firstName, patronymic, surName, dateOfBirth) values ('Ìîäåñò', 'Òðîôèìîâè÷', 'Ìåäâåäöêèé-Ãàóïìàí', '1943-01-12');
insert into st_student_teacher (student_id, teacher_id) values (1,1);
insert into st_student_teacher (student_id, teacher_id) values (1,2);
insert into st_student_teacher (student_id, teacher_id) values (1,3);
insert into st_student_teacher (student_id, teacher_id) values (2,1);
insert into st_student_teacher (student_id, teacher_id) values (3,2);
insert into st_student_teacher (student_id, teacher_id) values (4,2);
insert into st_student_teacher (student_id, teacher_id) values (5,2);
insert into st_student_teacher (student_id, teacher_id) values (5,1);
insert into st_student_teacher (student_id, teacher_id) values (6,2);
insert into st_student_teacher (student_id, teacher_id) values (6,3);
insert into st_person (surName, firstName, patronymic) values ("Èâàíîâ", "Ïåòð", "Ñåðãååâè÷");
insert into st_person (surName, firstName, patronymic) values ("Êëåáàíîâ", "Èëüÿ", "Ñåìåíîâè÷");
insert into st_person (surName, firstName, patronymic) values ("Òðóõèí", "Ìèõàèë", "Âèêòîðîâè÷");
insert into st_person (surName, firstName, patronymic) values ("Ñåìåíîâ", "Èëüÿ", "Äìèòðèåâè÷");
insert into st_company (companyName) values ("Ôèíàíñîâàÿ êîìïàíèÿ");
insert into st_company (companyName) values ("Ñòðîèòåëüíàÿ ôèðìà");
insert into st_company (companyName) values ("Òîðãîâûé õîëäèíã");
insert into st_account (person_id, company_id, account_name) values (1,2,"Äîãîâîð 1");
insert into st_account (person_id, company_id, account_name) values (1,2,"Äîãîâîð 2");
insert into st_account (person_id, company_id, account_name) values (1,1,"Äîãîâîð 3");
insert into st_account (person_id, company_id, account_name) values (2,3,"Äîãîâîð 4");
insert into st_account (person_id, company_id, account_name) values (2,1,"Äîãîâîð 5");
insert into st_account (person_id, company_id, account_name) values (3,2,"Äîãîâîð 6");
insert into st_account (person_id, company_id, account_name) values (4,1,"Äîãîâîð 7");
insert into st_account (person_id, company_id, account_name) values (4,2,"Äîãîâîð 8");
insert into st_account (person_id, company_id, account_name) values (4,3,"Äîãîâîð 9");
insert into st_account_firm (company_from, company_to, account_name) values (1,2,"Äîãîâîð 1");
insert into st_account_firm (company_from, company_to, account_name) values (1,2,"Äîãîâîð 2");
insert into st_account_firm (company_from, company_to, account_name) values (1,1,"Äîãîâîð 3");
insert into st_account_firm (company_from, company_to, account_name) values (2,3,"Äîãîâîð 4");
insert into st_account_firm (company_from, company_to, account_name) values (2,1,"Äîãîâîð 5");
insert into st_account_firm (company_from, company_to, account_name) values (3,2,"Äîãîâîð 6");
insert into st_account_firm (company_from, company_to, account_name) values (3,1,"Äîãîâîð 7");
insert into st_account_firm (company_from, company_to, account_name) values (3,2,"Äîãîâîð 8");
insert into st_account_firm (company_from, company_to, account_name) values (3,3,"Äîãîâîð 9");
delimiter //
CREATE PROCEDURE get_students()
BEGIN
SELECT student_id, firstName, surName
FROM st_student;
END;
//
CREATE PROCEDURE get_student(IN id int)
BEGIN
SELECT student_id, firstName, surName
FROM st_student WHERE student_id = id;
END;
//
delimiter ;
Morty Proxy This is a proxified and sanitized view of the page, visit original site.