首先创建示例表,再初始化几条测试数据
create table t_score
(
id number primary key,
student_id number(3),
student_name char(8) not null,
sub_name varchar2(20),
score number(10,2)
);
insert into t_score (id, student_id, student_name, sub_name, score)
values (1, 1, 'John', 'c#', 90);
insert into t_score (id, student_id, student_name, sub_name, score)
values (2, 1, 'John', 'php', 97);
insert into t_score (id, student_id, student_name, sub_name, score)
values (3, 1, 'John', 'java', 85);
insert into t_score (id, student_id, student_name, sub_name, score)
values (4, 2, 'Lili', 'c#', 75);
insert into t_score (id, student_id, student_name, sub_name, score)
values (5, 2, 'Lili', 'php', 55);
insert into t_score (id, student_id, student_name, sub_name, score)
values (6, 2, 'Lili', 'java', 91);
insert into t_score (id, student_id, student_name, sub_name, score)
values (7, 3, 'Tom', 'c#', 40);
insert into t_score (id, student_id, student_name, sub_name, score)
values (8, 3, 'Tom', 'php', 89);
insert into t_score (id, student_id, student_name, sub_name, score)
values (9, 3, 'Tom', 'java', 98);
commit;