当前位置:网站首页>PLSQL package
PLSQL package
2022-07-26 20:56:00 【EbowTang】
A package is a type that correlates all kinds of logic 、 Constant 、 Variable 、 Exception and subroutine combined pattern object . A package usually consists of two parts : Package description and package body , But sometimes inclusions are not needed . Package specification ( Shorthand for spec) It's the API ; It declares the available types 、 Variable 、 Constant 、 abnormal 、 Cursors and subroutines , Inclusion body (Body) Partially and completely define cursors and subroutines , And implement the contents in the description .
As shown in the following example , We can consider the description part as an optional interface , And the inclusion is a " Black box ". We can debug it 、 Enhance or replace a package and change the interface differently ( Package specification ).

We can SQL*Plus Use in CREATE PACKAGE Statement to create a package . The grammar is as follows :
|
The contents declared in the package description are public , Visible to the application . We must be in all other content ( In addition to the compilation instructions for naming a particular function ; Such compilation instructions must follow the function description ) Subroutines can be declared only after declaration .
The contents in the package have private , It implements the details defined in the description part , And invisible to the application . Follow closely The declaration part of the package body is an optional initialization part , It is used to initialize variables in the package .
AUTHID Statement determines whether all packaged subroutines are defined according to the permission of the definer ( Default ) Or the caller has permission to execute , Whether the schema object involved is resolved in the definer's schema or the caller's schema .
A call description allows us to Oracle Publish a in the data dictionary Java Method or external C function . Call the name of the handle program 、 Parameter types and return types map to their SQL copy (SQL counterpart) To release the program .
Package form :
Package Described by the package (package Specification) And inclusion (package body) Two parts make up ; Package specification Partly equivalent to C In language .H file , The inclusion part is equivalent to C The language is aimed at .H Realized C file .
Package Commonly used SQL:
create or replace package—— Create a package
create or replace package body ——— Create enclaves
drop package———— Delete package
drop package body———— Delete inclusion
Package benefits :
1、 modularization : Generally, functions and processes with correlation are put into a Package in ;
2、 Easy to design : You can write and compile the package description and package body respectively , Write and compile the package description first , In the preparation and description of the inclusion body ; This is beneficial In the division of labor and cooperation ;
3、 Information hiding : The function description can appear in the package body , Only the functions and procedures that appear in the package description are the Package Of public ownership Functions and procedures , Can be called by functions in other packages , Otherwise, it is invisible to functions in other packages , Functions that do not appear in the package description section And processes are equivalent to private .
4、 Improved loading performance : When Package When a function or procedure is called in , Whole Packege Is loaded into memory , It's time to do that Package When other functions in are called , Just read it directly from memory , Can reduce the number of disks IO, To improve performance .
This feature also reminds We're not going to make Big Macs Package, Take whatever you need Functions are written in a Package in , This can lead to a serious waste of memory .
5、 heavy load : One package The same name can be defined in 、 Functions or procedures with different parameters .
Package Forward declaration feature in :
stay Package body in , Calling another function in a function ( It's also here Package in ), Otherwise A function must be defined first ;
If you have to call a function defined in the program code , You can set this function as a public function , Explain in the package description section ;
/*
-- Date of creation : 2022-07-19
-- author : ebowtang
-- Function description : plsql Practice of bag , The package is written around three related tables , Simulate a series of school queries , increase , Delete and other functions
-- object : Student information sheet , League tables , The curriculum
-- Other matters needing attention :
-- 1, This script file completely contains all the test code , You can choose to execute in the specified section
-- 2, The module details used in the script writing and testing process are preserved , For reference ,
-- For example, you will see separate get_namelist01 Process code , Actually, the corresponding one is in the package get_grade_namelist, I verify it first, and then put it into the package .
*/
-- Define package specifications , The package specification will be used for the interface part of the application , For external calls
CREATE OR REPLACE PACKAGE stu_pkg as
---- The three cursor variables of Fame point to the collection of all grades in high school
cursor cur_students_one is select * from students where grade = ' First year of high school ';
cursor cur_students_two is select * from students where grade = ' Senior high school grade two ';
cursor cur_students_three is select * from students where grade = ' Third year of high school ';
-- A variable is used to save a record of the cursor
v_stu students%rowtype;
-- Limit the number of people displayed
max_show_number integer := 100;
-- Define the process : New student registration
PROCEDURE signup(p_stu_id number ,p_stu_name char,p_gender varchar2,p_age number,
p_grade varchar2,p_class varchar2,p_email varchar2,p_sdate DATE);
-- Define the process : Expel a student
PROCEDURE expel_student( p_stu_id NUMBER );
-- Implementation process : Get the specified grade 、 Before the grade of the designated discipline 100 ranking ( All semesters )
procedure get_grade_scores(p_grade varchar2 , p_course_name char );
-- Implementation process : Get the test score statistics of the specified semester ( average , Total score , The highest , Lowest score ), And rank according to the total score
procedure get_statistics_scores(p_grade varchar2,p_batch char );
-- Query the evaluation level of students' grades ( distinguish ABCDE, Do not publish the value to students )
procedure get_evaluate(p_stu_id number,p_batch varchar2);
-- Implementation function : Modify the scores of designated students
function change_score ( p_score int, p_stu_id number,
p_course varchar2, p_batch varchar2 ) return int;
-- Implementation process : Get the list of grades
procedure get_grade_namelist(p_grade varchar2);
-- Implementation function : The total score of one of the specified students
FUNCTION get_totalscore(p_stuid scores.student_id%type) RETURN scores.score_value%type;
END stu_pkg;
-- Implementation package
CREATE OR REPLACE PACKAGE BODY stu_pkg AS
-- Realize the specific realization of employing employees
PROCEDURE signup(p_stu_id number ,p_stu_name char,p_gender varchar2,p_age number,
p_grade varchar2,p_class varchar2,p_email varchar2,p_sdate DATE) IS
begin
-- Implementation process : New students register
INSERT INTO students VALUES(p_stu_id ,p_stu_name,p_gender,p_age,
p_grade,p_class,p_email,p_sdate);
END;
-- Implementation process : Expel a student
PROCEDURE expel_student(p_stu_id NUMBER ) IS
BEGIN
-- from emp Delete employee information in the table
DELETE FROM scores WHERE student_id=p_stu_id;
DELETE FROM students WHERE student_id=p_stu_id;
END;
-- Implementation process : Get the specified grade 、 Before the grade of the designated discipline 100 ranking ( All semesters )
procedure get_grade_scores(p_grade varchar2 , p_course_name char ) is
begin
select student_name,grade,course_name,score_value,scores.batch
from students,scores,courses
where scores.student_id = students.student_id
and courses.course_name = p_course_name
and courses.course_id = scores.course_id
and students.grade = p_grade
order by score_value desc
limit max_show_number;
END;
-- Implementation process : Get the test score statistics of the specified semester ( average , Total score , The highest , Lowest score ), And rank according to the total score
procedure get_statistics_scores(p_grade varchar2,p_batch char ) is
BEGIN
select *
from students,(
select student_id as Student ID,round(avg(score_value),1) as average ,sum(score_value) as Total score ,max(score_value) as The highest ,min(score_value) as Lowest score
from scores
group by student_id,batch
having batch=p_batch
)
where grade = p_grade and students.student_id = Student ID
order by Total score desc ;
END;
-- Implementation process : Query the evaluation level of students' grades ( distinguish ABCDE, Do not publish the value to students )( Fixed access to Mathematics )
procedure get_evaluate(p_stu_id number,p_batch varchar2) as
l_course_id varchar2;
l_score number;
l_grade varchar2;
tempscore number := 0;
l_course_name varchar2 := ' mathematics ';
begin
select course_id into l_course_id
from courses
where course_name= ' mathematics ' and category = ' Liberal arts ';
select score_value into l_score
from scores
where student_id =p_stu_id and course_id = l_course_id and batch=p_batch;
if l_course_name = ' English ' or l_course_name = ' mathematics ' or l_course_name = ' Chinese language and literature ' then
tempscore =l_score/150;
else
tempscore =l_score/100;
end if;
-- Different score segments are rated differently
CASE TRUE
WHEN tempscore < 1.0 and tempscore > 0.9
THEN l_grade ='A';
WHEN tempscore < 0.9 and tempscore > 0.8
THEN l_grade ='B';
WHEN tempscore < 0.8 and tempscore > 0.7
THEN l_grade ='C';
WHEN tempscore < 0.7 and tempscore > 0.6
THEN l_grade ='D';
ELSE l_grade ='E';
END CASE;
RAISE NOTICE 'your Score grade is:% %',l_score, l_grade;
END;
-- Implementation function : Revise student scores
function change_score ( p_score int, p_stu_id number,
p_course varchar2, p_batch varchar2 ) return int as
begin
if p_score > 150 or p_score < 0 then
return 0;
end if;
update scores set score_value=p_score
where student_id =p_stu_id and course_id =p_course and batch=p_batch;
return 1;
end;
-- Implementation process : Get the list of grades
procedure get_grade_namelist(p_grade varchar2) as
begin
-- Open cursor
if p_grade = ' First year of high school ' then
open cur_students_one;
-- Do it once fetch into Let the cursor point to the first data
fetch cur_students_one into v_stu;
--while loop , Conditions are cyclic conditions
while cur_students_one%found loop
-- Print student information
--dbms_output.put_line(v_stu.student_id ||','|| v_stu.student_name);
RAISE NOTICE 'student id is:% ,student_name is %',v_stu.student_id,v_stu.student_name;
--fetch into Point the cursor to the next data
fetch cur_students_one into v_stu;
end loop;
--dbms_output.put_line(cur_students_one%rowcount||'');
RAISE NOTICE 'Number of students is:%',cur_students_one%rowcount;
-- Close cursor
close cur_students_one;
elsif p_grade = ' Senior high school grade two ' then
open cur_students_two;
-- Do it once fetch into Let the cursor point to the first data
fetch cur_students_two into v_stu;
--while loop , Conditions are cyclic conditions
while cur_students_two%found loop
-- Print student information
--dbms_output.put_line(v_stu.student_id ||','|| v_stu.student_name);
RAISE NOTICE 'student id is:% ,student_name is %',v_stu.student_id,v_stu.student_name;
--fetch into Point the cursor to the next data
fetch cur_students_two into v_stu;
end loop;
--dbms_output.put_line(cur_students_two%rowcount||'');
RAISE NOTICE 'Number of students is:%',cur_students_two%rowcount;
-- Close cursor
close cur_students_two;
elsif p_grade = ' Third year of high school ' then
open cur_students_three;
-- Do it once fetch into Let the cursor point to the first data
fetch cur_students_three into v_stu;
--while loop , Conditions are cyclic conditions
while cur_students_three%found loop
-- Print student information
--dbms_output.put_line(v_stu.student_id ||','|| v_stu.student_name);
RAISE NOTICE 'student id is:% ,student_name is %',v_stu.student_id,v_stu.student_name;
--fetch into Point the cursor to the next data
fetch cur_students_three into v_stu;
end loop;
--dbms_output.put_line(cur_students_three%rowcount||'');
RAISE NOTICE 'Number of students is:%',cur_students_three%rowcount;
-- Close cursor
close cur_students_three;
else
RAISE NOTICE 'your enter grade is error ';
end if;
end;
FUNCTION get_totalscore(p_stuid scores.student_id%type) RETURN scores.score_value%TYPE
AS
v_maxscore scores.score_value%type := 0;
begin
select sum(score_value) into v_maxscore
from scores
group by student_id,batch
having batch=' midsemester ' and student_id = p_stuid;
RETURN v_maxscore;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE NOTICE 'The student id is invalid';
RETURN -1;
END get_totalscore;
END stu_pkg;
-- Anonymous blocks perform package tests
declare
l_grade char;
begin
-- Expulsion of students ( According to the student number )
stu_pkg.expel_student(2314);
-- Register a student ( Constrained )
stu_pkg.signup(2314,' Zhang Detian ',' male ',19,' First year of high school ',' Class eight ','[email protected]',SYSDATE);
-- Count the student's scores ( Total score , Highest grade )
stu_pkg.get_statistics_scores(' Senior high school grade two ',' final exam ');
-- Get grades (ABCDE)
stu_pkg.get_evaluate(4324,' final exam ');
-- Get the grade ranking of specified subjects
stu_pkg.get_grade_scores(' Third year of high school ',' Chinese language and literature ');
-- Revise grades
select stu_pkg.change_score(141,2314,'02',' midsemester ') from dual;
-- Verify whether the modification of student grades is successful
select score_value from scores where course_id='02' and student_id=2314;
-- Test stored procedures written separately -- Realize grade list query ( Non package stored procedures )
call get_namelist01(' First year of high school ');
-- Test stored procedures written separately ( Non package stored procedures )
stu_pkg.get_grade_namelist(' Third year of high school ');
-- Get the total score of the designated student ( Entering an incorrect student number will detect an exception )
select stu_pkg.get_totalscore(2614) from dual;
end
---------------------plsql The modules of the package are tested separately -----------------------------
CREATE OR REPLACE FUNCTION get_totalscore(p_stuid scores.student_id%type) RETURN scores.score_value%TYPE
AS
v_maxscore scores.score_value%type := 0;
begin
select sum(score_value) into v_maxscore
from scores
group by student_id,batch
having batch=' midsemester ' and student_id = p_stuid;
RETURN v_maxscore;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE NOTICE 'The student id is invalid';
RETURN -1;
END get_totalscore;
-- test
begin
--select * from scores;
select get_totalscore(4324) from dual;
end
select sum(score_value)
from scores
group by student_id,batch
having batch=' midsemester ' and student_id = 2614;
select score_value
from scores
where batch=' midsemester ' and student_id = '2614' and course_id = 01;
-- Nested table
CREATE OR REPLACE TYPE stu_arr_typ IS TABLE OF char(8);
create or replace procedure test01 as
stu_arr stu_arr_typ :=stu_arr_typ();
CURSOR stu_cur IS SELECT student_name FROM students WHERE age > 19;
--v_student_name students.student_name%type;
v_student_name char(8);
i INTEGER := 0;
BEGIN
open stu_cur;
fetch stu_cur into v_student_name;
while stu_cur%found loop
RAISE NOTICE 'name list is % ',v_student_name;
fetch stu_cur into v_student_name;
end loop;
close stu_cur;
END ;
-- test
begin
call test01();
end
open stu_cur;
fetch stu_cur into v_student_name;
while stu_cur%found loop
stu_arr(i) := v_student_name;
RAISE NOTICE 'name list is % ',stu_arr(i);
i := i+1;
fetch stu_cur into v_student_name;
end loop;
close stu_cur;
declare
-- Claim a nested table type , Store string data
type tabType is table of varchar2(200);
-- Name variable
tab1 tabType;
tab2 tabType;
-- Claim that a variable holds the subscript of the nested table
ind pls_integer;
begin
-- Initialize nested tables
tab1:=tabType();
-- Print nested tables tab1 The length of
--dbms_output.put_line('tab1 The length of '||tab1.count);
RAISE NOTICE 'tab2 The length of % ',tab1.count;
-- Initialize nested tables tab2
tab2:=tabType('a','b','c','d');
-- Print nested tables tab2 The length of
--dbms_output.put_line('tab2 The length of '||tab2.count);
RAISE NOTICE 'tab2 The length of % ',tab2.count;
--- Ergodic set
ind := 1;
loop--loop loop
-- Print set elements
dbms_output.put_line(tab2(ind));
-- Exit conditions
exit when ind=tab2.last;
ind:=tab2.next(ind);
end loop;
for i in tab2.first..tab2.last loop--for loop
RAISE NOTICE 'tab2 is % ',tab2(i);
end loop;
end;
DECLARE
TYPE Roster IS TABLE OF VARCHAR2(15); -- nested table type
-- nested table variable initialized with constructor:
names Roster := Roster('D Caruso', 'J Hamil', 'D Piro', 'R Singh');
PROCEDURE print_names (heading VARCHAR2) IS
BEGIN
DBMS_OUTPUT.PUT_LINE(heading);
FOR i IN names.FIRST .. names.LAST LOOP -- For first to last element
DBMS_OUTPUT.PUT_LINE(names(i));
END LOOP;
DBMS_OUTPUT.PUT_LINE('---');
END;
BEGIN
print_names('Initial Values:');
names(3) := 'P Perez'; -- Change value of one element
print_names('Current Values:');
names := Roster('A Jansen', 'B Gupta'); -- Change entire table
print_names('Current Values:');
END;
/
-- Define three cursors to get grade data
create or replace procedure get_namelist01(p_grade varchar2) as
-- Three cursors
cursor cur_students_one is select * from students where grade = ' First year of high school ';
cursor cur_students_two is select * from students where grade = ' Senior high school grade two ';
cursor cur_students_three is select * from students where grade = ' Third year of high school ';
-- A variable is used to save a record of the cursor
v_stu students%rowtype;
begin
-- Open cursor
if p_grade = ' First year of high school ' then
open cur_students_one;
-- Do it once fetch into Let the cursor point to the first data
fetch cur_students_one into v_stu;
--while loop , Conditions are cyclic conditions
while cur_students_one%found loop
-- Print student information
--dbms_output.put_line(v_stu.student_id ||','|| v_stu.student_name);
RAISE NOTICE 'student id is:% ,student_name is %',v_stu.student_id,v_stu.student_name;
--fetch into Point the cursor to the next data
fetch cur_students_one into v_stu;
end loop;
--dbms_output.put_line(cur_students_one%rowcount||'');
RAISE NOTICE 'Number of students is:%',cur_students_one%rowcount;
-- Close cursor
close cur_students_one;
elsif p_grade = ' Senior high school grade two ' then
open cur_students_two;
-- Do it once fetch into Let the cursor point to the first data
fetch cur_students_two into v_stu;
--while loop , Conditions are cyclic conditions
while cur_students_two%found loop
-- Print student information
--dbms_output.put_line(v_stu.student_id ||','|| v_stu.student_name);
RAISE NOTICE 'student id is:% ,student_name is %',v_stu.student_id,v_stu.student_name;
--fetch into Point the cursor to the next data
fetch cur_students_two into v_stu;
end loop;
--dbms_output.put_line(cur_students_two%rowcount||'');
RAISE NOTICE 'Number of students is:%',cur_students_two%rowcount;
-- Close cursor
close cur_students_two;
elsif p_grade = ' Third year of high school ' then
open cur_students_three;
-- Do it once fetch into Let the cursor point to the first data
fetch cur_students_three into v_stu;
--while loop , Conditions are cyclic conditions
while cur_students_three%found loop
-- Print student information
--dbms_output.put_line(v_stu.student_id ||','|| v_stu.student_name);
RAISE NOTICE 'student id is:% ,student_name is %',v_stu.student_id,v_stu.student_name;
--fetch into Point the cursor to the next data
fetch cur_students_three into v_stu;
end loop;
--dbms_output.put_line(cur_students_three%rowcount||'');
RAISE NOTICE 'Number of students is:%',cur_students_three%rowcount;
-- Close cursor
close cur_students_three;
else
RAISE NOTICE 'your enter grade is error ';
end if;
end
-- The cursor test obtains the student grade data
declare
-- A cursor variable points to the collection of second grade students in high school
cursor cur_to_stu is select * from students where grade = ' Senior high school grade two ';
-- A variable is used to save a record of the cursor
v_stu students%rowtype;
begin
-- Open cursor
open cur_to_stu;
-- Do it once fetch into Let the cursor point to the first data
fetch cur_to_stu into v_stu;
--while loop , Conditions are cyclic conditions
while cur_to_stu%found loop
-- Print student information
--dbms_output.put_line(v_stu.student_id ||','|| v_stu.student_name);
RAISE NOTICE 'student id is:% ,student_name is %',v_stu.student_id,v_stu.student_name;
--fetch into Point the cursor to the next data
fetch cur_to_stu into v_stu;
end loop;
--dbms_output.put_line(cur_to_stu%rowcount||'');
RAISE NOTICE 'Number of students is:%',cur_to_stu%rowcount;
-- Close cursor
close cur_to_stu;
end
create or replace function change_score ( p_score int, p_stu_id number,
p_course varchar2, p_batch varchar2 ) return int as
begin
if p_score > 150 or p_score < 0 then
return 0;
end if;
update scores set score_value=p_score
where student_id =p_stu_id and course_id =p_course and batch=p_batch;
return 1;
end;
select *
from courses
where course_name=' mathematics ' and category = ' Liberal arts ';
create or replace procedure getaaa(p_stu_id number,p_batch varchar2) as
l_course_id varchar2;
l_score number;
l_grade varchar2;
tempscore number := 0;
l_course_name varchar2 := ' mathematics ';
begin
select course_id into l_course_id
from courses
where course_name= ' mathematics ' and category = ' Liberal arts ';
select score_value into l_score
from scores
where student_id =p_stu_id and course_id = l_course_id and batch=p_batch;
if l_course_name = ' English ' or l_course_name = ' mathematics ' or l_course_name = ' Chinese language and literature ' then
tempscore =l_score/150;
else
tempscore =l_score/100;
end if;
CASE TRUE
WHEN tempscore < 1.0 and tempscore > 0.9
THEN l_grade ='A';
WHEN tempscore < 0.9 and tempscore > 0.8
THEN l_grade ='B';
WHEN tempscore < 0.8 and tempscore > 0.7
THEN l_grade ='C';
WHEN tempscore < 0.7 and tempscore > 0.6
THEN l_grade ='D';
ELSE l_grade ='E';
END CASE;
RAISE NOTICE 'your Score grade is:% %',l_score, l_grade;
-- You can also use system packages :DBMS_OUTPUT.PUT_LINE(l_grade);
END;
---------------------plsql The module of the package is implemented separately, and the test ends -----------------------------
------------------ Simple SQL test -----------------------
-- Check the grade sheet
select * from scores;
-- Check the curriculum
select * from courses;
-- Check the experiment table
select * from students;
-- Check the subject grades
select student_name,grade,course_name,score_value,scores.batch
from students,scores,courses
where scores.student_id = students.student_id
and courses.course_name = ' mathematics '
and courses.course_id = scores.course_id
and grade =' Senior high school grade two '
order by score_value desc
limit 3;
-- Check the grades and total scores of all subjects in the specified grade
select students.student_name,grade,course_name,score_value,sum(score_value) as total,scores.batch
from students,scores,courses
where scores.student_id = students.student_id
and courses.course_id = scores.course_id
order by score_value desc;
-- Statistics results
select student_id as Student ID,round(avg(score_value),1) as average ,sum(score_value) as Total score ,max(score_value) as The highest ,min(score_value) as Lowest score
from scores
group by student_id,batch
having batch=' midsemester ';
-- Count the grades of the designated grades
select *
from students,(
select student_id as Student ID,round(avg(score_value),1) as average ,sum(score_value) as Total score ,max(score_value) as The highest ,min(score_value) as Lowest score
from scores
group by student_id,batch
having batch=' midsemester '
)
where grade = ' Senior high school grade two ' and students.student_id = Student ID
order by Total score desc ;
-- Clean up the experimental environment
drop table if exists scores;
drop table if exists courses;
drop table if exists students;
-- Test delete a student
DELETE FROM scores WHERE student_id=1414;
DELETE FROM students WHERE student_id=1414;-- You can't just delete this , Because there are foreign keys
------------------ Simple SQL End of test -----------------------
---------------------- Create an experiment table and its data -----------------------------
/*
-- Experimental data and its objects
*/
-- Create student table
CREATE TABLE students (
student_id number(8),
student_name char(8) not null,
gender varchar2(2),
age number(2),
grade varchar2 (40) not null,
class varchar2 (40) not null,
email varchar2 (30),
sdate DATE,
constraint pk_stuid primary key (student_id),
constraint ch_gender check ( gender in (' male ',' Woman ')),
constraint ch_grade check ( grade in (' First year of high school ',' Senior high school grade two ',' Third year of high school ')),
constraint ch_age CHECK ( age BETWEEN 12 AND 36)
);
-- Create a score sheet
create table scores (
student_id number(8),
course_id char(2),
score_value number(3) default(-1),
batch varchar2(20)
);
-- Create a curriculum
create table courses (
course_id char(2) primary key,
course_name char(20),
category char(20) check( category in (' Liberal arts ',' science ',' Arts and Sciences '))
);
-- Insert student data
INSERT INTO students VALUES(2314,' Zhang Detian ',' male ',19,' First year of high school ',' Class eight ','[email protected]',SYSDATE);
INSERT INTO students VALUES(4324,' Wu Haifeng ',' male ',18,' First year of high school ',' First class ','[email protected]',SYSDATE);
INSERT INTO students VALUES(2614,' Zhangdezheng ',' male ',20,' Senior high school grade two ',' The second shift ','[email protected]',SYSDATE);
INSERT INTO students VALUES(2184,' Song Yiran ',' Woman ',20,' Third year of high school ',' The third shift ','[email protected]',SYSDATE);
INSERT INTO students VALUES(9874,' Zhanghuale ',' Woman ',19,' Senior high school grade two ',' The second shift ','[email protected]',SYSDATE);
INSERT INTO students VALUES(1474,' Li Wenyue ',' Woman ',19,' Third year of high school ',' Class seven ','[email protected]',SYSDATE);
INSERT INTO students VALUES(6574,' auspicious ',' male ',21,' Senior high school grade two ',' Class six ','[email protected]',SYSDATE);
INSERT INTO students VALUES(8174,' Xiang Ling ',' Woman ',19,' Senior high school grade two ',' Fourth shift ','[email protected]',SYSDATE);
INSERT INTO students VALUES(1414,' Meitiantian ',' Woman ',21,' First year of high school ',' Class five ','[email protected]',SYSDATE);
-- Insert course data
insert into courses values('01',' Chinese language and literature ',' Arts and Sciences ');
insert into courses values('06',' English ',' Arts and Sciences ');
insert into courses values('02',' mathematics ',' Liberal arts ');
insert into courses values('03',' Politics ',' Liberal arts ');
insert into courses values('04',' Geography ',' Liberal arts ');
insert into courses values('05',' history ',' Liberal arts ');
insert into courses values('07',' mathematics ',' science ');
insert into courses values('08',' biological ',' science ');
insert into courses values('09',' chemical ',' science ');
insert into courses values('10',' Physics ',' science ');
-- Insert student grades , final exam
insert into scores values(2314,'01',110,' final exam ');
insert into scores values(4324,'01',109,' final exam ');
insert into scores values(2614,'01',88,' final exam ');
insert into scores values(2184,'01',121,' final exam ');
insert into scores values(9874,'01',114,' final exam ');
insert into scores values(1474,'01',103,' final exam ');
insert into scores values(6574,'01',113,' final exam ');
insert into scores values(8174,'01',108,' final exam ');
insert into scores values(1414,'01',125,' final exam ');
insert into scores values(2314,'02',100,' final exam ');
insert into scores values(4324,'02',104,' final exam ');
insert into scores values(2614,'02',99,' final exam ');
insert into scores values(2184,'02',101,' final exam ');
insert into scores values(9874,'02',104,' final exam ');
insert into scores values(1474,'02',113,' final exam ');
insert into scores values(6574,'02',103,' final exam ');
insert into scores values(8174,'02',118,' final exam ');
insert into scores values(1414,'02',129,' final exam ');
insert into scores values(2314,'06',101,' final exam ');
insert into scores values(4324,'06',103,' final exam ');
insert into scores values(2614,'06',127,' final exam ');
insert into scores values(2184,'06',105,' final exam ');
insert into scores values(9874,'06',101,' final exam ');
insert into scores values(1474,'06',109,' final exam ');
insert into scores values(6574,'06',100,' final exam ');
insert into scores values(8174,'06',99,' final exam ');
insert into scores values(1414,'06',114,' final exam ');
insert into scores values(2314,'03',56,' final exam ');
insert into scores values(4324,'03',75,' final exam ');
insert into scores values(2614,'03',26,' final exam ');
insert into scores values(2184,'03',76,' final exam ');
insert into scores values(9874,'03',89,' final exam ');
insert into scores values(1474,'03',90,' final exam ');
insert into scores values(6574,'03',91,' final exam ');
insert into scores values(8174,'03',57,' final exam ');
insert into scores values(1414,'03',92,' final exam ');
insert into scores values(2314,'04',76,' final exam ');
insert into scores values(4324,'04',87,' final exam ');
insert into scores values(2614,'04',56,' final exam ');
insert into scores values(2184,'04',36,' final exam ');
insert into scores values(9874,'04',84,' final exam ');
insert into scores values(1474,'04',64,' final exam ');
insert into scores values(6574,'04',82,' final exam ');
insert into scores values(8174,'04',47,' final exam ');
insert into scores values(1414,'04',66,' final exam ');
insert into scores values(2314,'05',67,' final exam ');
insert into scores values(4324,'05',83,' final exam ');
insert into scores values(2614,'05',52,' final exam ');
insert into scores values(2184,'05',26,' final exam ');
insert into scores values(9874,'05',96,' final exam ');
insert into scores values(1474,'05',91,' final exam ');
insert into scores values(6574,'05',81,' final exam ');
insert into scores values(8174,'05',87,' final exam ');
insert into scores values(1414,'05',92,' final exam ');
-- insert data , midsemester
insert into scores values(2314,'01',110,' midsemester ');
insert into scores values(4324,'01',119,' midsemester ');
insert into scores values(2614,'01',95,' midsemester ');
insert into scores values(2184,'01',131,' midsemester ');
insert into scores values(9874,'01',145,' midsemester ');
insert into scores values(1474,'01',124,' midsemester ');
insert into scores values(6574,'01',124,' midsemester ');
insert into scores values(8174,'01',109,' midsemester ');
insert into scores values(1414,'01',121,' midsemester ');
insert into scores values(2314,'02',100,' midsemester ');
insert into scores values(4324,'02',104,' midsemester ');
insert into scores values(2614,'02',99,' midsemester ');
insert into scores values(2184,'02',101,' midsemester ');
insert into scores values(9874,'02',104,' midsemester ');
insert into scores values(1474,'02',113,' midsemester ');
insert into scores values(6574,'02',103,' midsemester ');
insert into scores values(8174,'02',118,' midsemester ');
insert into scores values(1414,'02',129,' midsemester ');
insert into scores values(2314,'06',105,' midsemester ');
insert into scores values(4324,'06',128,' midsemester ');
insert into scores values(2614,'06',126,' midsemester ');
insert into scores values(2184,'06',102,' midsemester ');
insert into scores values(9874,'06',107,' midsemester ');
insert into scores values(1474,'06',112,' midsemester ');
insert into scores values(6574,'06',102,' midsemester ');
insert into scores values(8174,'06',100,' midsemester ');
insert into scores values(1414,'06',102,' midsemester ');
insert into scores values(2314,'03',56,' midsemester ');
insert into scores values(4324,'03',77,' midsemester ');
insert into scores values(2614,'03',72,' midsemester ');
insert into scores values(2184,'03',73,' midsemester ');
insert into scores values(9874,'03',81,' midsemester ');
insert into scores values(1474,'03',82,' midsemester ');
insert into scores values(6574,'03',87,' midsemester ');
insert into scores values(8174,'03',67,' midsemester ');
insert into scores values(1414,'03',91,' midsemester ');
insert into scores values(2314,'04',78,' midsemester ');
insert into scores values(4324,'04',80,' midsemester ');
insert into scores values(2614,'04',85,' midsemester ');
insert into scores values(2184,'04',67,' midsemester ');
insert into scores values(9874,'04',85,' midsemester ');
insert into scores values(1474,'04',69,' midsemester ');
insert into scores values(6574,'04',80,' midsemester ');
insert into scores values(8174,'04',65,' midsemester ');
insert into scores values(1414,'04',69,' midsemester ');
insert into scores values(2314,'05',69,' midsemester ');
insert into scores values(4324,'05',81,' midsemester ');
insert into scores values(2614,'05',44,' midsemester ');
insert into scores values(2184,'05',56,' midsemester ');
insert into scores values(9874,'05',90,' midsemester ');
insert into scores values(1474,'05',84,' midsemester ');
insert into scores values(6574,'05',84,' midsemester ');
insert into scores values(8174,'05',76,' midsemester ');
insert into scores values(1414,'05',78,' midsemester ');
---------------------- End of creating the experiment table and its data -----------------------------边栏推荐
- South Korea plans to spend 1 trillion won a year on research and development of semiconductor materials and equipment
- 营销与销售文件管理以及工作流程解决方案
- Group convolution
- 884. 两句话中的不常见单词-哈希表
- 李彦宏遭“泼冷水”热情不减!百度结盟华为麒麟,发布“鸿鹄”芯片
- The 50 Smartest Companies in the world announced that Chinese manufacturers account for nearly half, and Huawei ranks first
- twenty million two hundred and twenty thousand seven hundred and twenty-six
- Swiftui 4's new function of real-time access to click location.Ontapgeture {location in} (tutorial with source code)
- 如何查看你使用的pytorch是否为GPU版本
- 人脸识别、指纹识别都弱爆了?五角大楼研发远距离心跳识别
猜你喜欢

09_ue4进阶_进入下一关并保留血量

81. (cesium home) cesium modifies the gray background (default blue)

PointPillars: Fast Encoders for Object Detection from Point Clouds 阅读笔记

游览器——游览器游览器缓存

Buu brush inscription 2

详细图解b树及C语言实现

Houdini notes 2

Shell综合应用案例,归档文件

MPLS multi protocol label switching technology
![[wechat applet] zero basics | applet syntax](/img/3d/fb999fde6f61af62337464ea8e32bd.png)
[wechat applet] zero basics | applet syntax
随机推荐
单核A7玩转人脸识别,恩智浦“跨界处理器”又玩出新花样!
软考 --- 数据库(1)数据库基础
人脸识别、指纹识别都弱爆了?五角大楼研发远距离心跳识别
Shell综合应用案例,归档文件
Buu brush inscription - WANGDING cup column 2
Houdini notes 2
7.25 simulation summary
Basic configuration and aggregation of BGP
QT signal and slot connection (loose coupling)
leetcode 数组类
消息队列——引入的问题:重复消费&顺序消费&分布式事务
GOM登录器配置免费版生成图文教程
Build etcd distributed storage system +web management interface from scratch
Build Prometheus automatic monitoring and alarm system from scratch
Buu brush inscription 1
从零开始搭建Prometheus自动监控报警系统
Bean注入和生命周期
Beginner experience of safety testing
Using union to sort MySQL
游览器——游览器游览器缓存