Required functions:
(1) Entry and maintenance of student, course, teacher and other information. One course can only be taught by one teacher, and one teacher can teach multiple courses.
(2) Students select courses, about 20 credits per semester
(3) Teachers will give students’ scores after the end of each course. If students fail, they will record the make-up test scores after taking a make-up exam.
(4) Able to inquire in detail the course selection status of a certain student and the status of elective students in a certain course
(5) Ability to statistically query a student's transcript (total score, average score, number of failed doors, etc.) and statistical information such as the number of students taking a course, highest score, lowest score, average score, etc.
Table of contents
3.1 Conceptual structural design
3.1.4 Course Selection E-R Diagram
3.2.1 Convert the overall conceptual structure E-R diagram into a relational model
3.2.2 Optimization of data model
4.2 Creation of database tables
4.2.1 Create student information table
4.2.2 Create teacher information table
4.2.3 Create course information table
4.2.4 Create course selection information table
4.3 The relationship diagram is as follows
4.5.1 Add a student information to the student table
4.5.2 Modify Chen Chang’s mobile phone number
4.5.3 Delete Chen Chang’s personal information
4.7.1 Create a score table with information about make-up exams, including all columns
4.7.2 Create a course information table containing only professional basic courses
I. Introduction
1.1 Background of the topic
With the advent of the information age, computer technology has also been widely used, providing more advanced, convenient and efficient methods for the management of colleges and universities. In view of the problems of university academic management, developing a student information management system has become a very important and necessary task. The database experimental student information management system is a university management software developed based on database technology.
The main purpose of this system is to manage students’ basic information, course information, grade information, course selection information, etc. In the student information management system, students' basic information can be managed uniformly, such as name, student number, gender, date of birth, place of origin, contact information, etc., as well as student performance and course selection. At the same time, the system has access control functions, which can effectively prevent information from being stolen or modified. Through this system, comprehensive and meticulous management of students can be achieved, greatly improving work efficiency and reducing the investment in human resources.
1.2 Course design purpose
(1) Practical use of database technology: As a basic database application, the student information management system has basic operations and does not involve many tables and fields, but it is very practical and allows students to quickly get started with database software and understand common concepts and basics of databases. Function.
(2) Design and implementation of learning database: The student information management system involves the design of multiple related tables. Through the design and implementation of the learning system, students can understand the methods and techniques of database design, including entity and relationship modeling, table Design, definition of attributes, setting of indexes, and use of syntax, etc.
(3) Cultivate students' information management capabilities: The functions of the student information management system are relatively comprehensive, allowing students to learn basic methods and techniques of information management and improve their information management capabilities through information entry, query, and management.
(4) Improve students’ comprehensive application abilities: The design and implementation of student information management systems require knowledge from multiple disciplines, such as data structures, algorithms, database technologies, etc. Students’ comprehensive application abilities can be improved through practice.
1.3 Course design tasks
1. Requirements analysis: Clarify the requirements for the use, function, performance and quality of the student information management system, and formulate corresponding product requirements specifications.
2. Concept design: According to the requirements specification, model entities and relationships, design ER diagrams and table structures, and clarify the storage requirements of the database.
3. Logical design: Design the logical architecture of the system, including database modeling, writing of SQL statements and data dictionary, etc.
4. Physical design: Design the physical architecture of the system, including the creation, storage and management of databases, tables and indexes.
5. Implementation and testing: According to the design requirements, implement and test various functions of the student information management system, including record addition, modification, deletion, query, data statistics and report analysis, etc.
2. Demand analysis
The users of this system are student apartment managers and teachers. Their main tasks in daily apartment management include: inquiry and management of student information, dormitory allocation and adjustment, visitor registration, etc. Based on the analysis of the above requirements, this system should have the following functions in implementation:
◎ Student basic information management: add, modify, query, and delete student basic information;
◎ Teacher basic information management: add, modify, query and delete teacher basic information;
◎ Basic course information management: add, modify, query, and delete basic course information;
◎ Basic information management of course selection scores: adding, modifying, querying, deleting course selection information and scores, and entering make-up scores.
Based on the above analysis, the system architecture diagram of this system can be designed
3. System database design
3.1 Conceptual structural design
Based on the requirements analysis, the information structure is abstracted and the E-R diagram of the system can be obtained.
Partial E-R diagram
3.1.1 Student E-R diagram
3.1.2 Teacher E-R diagram
3.1.3 Course E-R diagram
3.1.4 Course Selection E-R Diagram
3.1.5 Overall E-R diagram
3.2 Logical structure design
3.2.1 Convert the overall conceptual structure E-R diagram into a relational model
Relational model:
Student (Student ID#, name, gender, contact information)
Teacher (Teacher number #, name, gender, contact information)
course (course number#, tutorial number, Course name, department)
Choice (Procedure number#、School number# ,growth type #, growth)
3.2.2 Optimization of data model
- Determine data dependencies
1. Student (Student ID#, name, gender, contact information)
Third paradigm: Student ID -> (name, gender, contact information)
2. Teacher (Teacher No.#, name, gender, contact information)
Third Normal Form: Teacher number->(Name, gender, contact information)
3. Course (Procedure #, Teacher number, course name, credits)
Third function:course number-> (Textbook number, Course name, Department)
4. Select (Enrollment number#、Academic degree#、Completion Type #, Growth)
Third option: (program course name, academic degree, completion type) ->( achievement)
- Minimize data dependencies between each relationship model and eliminate redundancy
Through analysis, it is found that there is no data redundancy in the relationship: the middle school number Sno in the student relationship determines the student's information; the teacher number is used as the primary key in the teacher relationship; the course number is used as the primary key in the course relationship; in the course selection relationship, (course number, student number, score type) together as the primary key to uniquely determine a test score. Because there are make-up exams, the score type needs to be used to differentiate. The score type habit can be selected as normal or make-up exams.
3.3 Physical structure design
3.3.1 Structure of student information table
serial number |
character name |
type of data |
length |
illustrate |
1 |
student ID |
char |
10 |
Student number, primary key |
2 |
Name |
varchar |
20 |
Empty is not allowed |
3 |
gender |
char |
2 |
Empty is not allowed check constraints |
4 |
Contact information |
char |
11 |
Allow empty |
5 |
Birthday |
Date |
Allow empty |
3.3.2 Structure of teacher information table
serial number |
character name |
type of data |
length |
illustrate |
1 |
Teacher number |
char |
10 |
Teacher number, primary key |
2 |
Name |
varchar |
20 |
Empty is not allowed |
3 |
gender |
char |
2 |
Empty is not allowed check constraints |
4 |
Contact information |
char |
11 |
Allow empty |
3.3.3 Structure of course information table
serial number |
Field Name |
type of data |
length |
illustrate |
1 |
Course number |
char |
10 |
primary key |
2 |
course name |
varchar |
20 |
Empty is not allowed |
3 |
Teacher number |
char |
10 |
Teacher number, foreign key |
4 |
credit |
tinyint |
non empty Check constraints |
3.3.4 Structure of course selection score information table
serial number |
Field Name |
type of data |
length |
illustrate |
1 |
student ID |
char |
10 |
primary key, foreign key |
2 |
Course number |
char |
10 |
primary key, foreign key |
3 |
grade type |
char |
2 |
primary key Check constraints |
4 |
Fraction |
tinyint |
non empty Check constraints |
Four, number installation implementation
4.1 Create database
create database sms
on primary
(
name=sms,
filename='D:\SQLSERVER_DB\sms.mdf',
size=20MB,
MAXsize=unlimited,
filegrowth=10MB
)
log on
(
name=sms_log,
filename='D:\SQLSERVER_DB\sms_log.ldf',
size=2mb,
maxsize=10mb,
filegrowth=10%
)
4.2 Creation of database tables
4.2.1 Create student information table
create table student(
sno char(10) primary key,
[name] varchar(20) not null,
sex char(2) not null check(sex='male' or sex='female'),
tel char(11)
)
4.2.2 Create teacher information table
create table teacher(
sno char(10) primary key,
[name] varchar(20) not null,
sex char(2) not null check(sex='male' or sex='female'),
tel char(11)
)
4.2.3 Create course information table
create table course(
cno char(10) primary key,
[cname] varchar(20) not null,
tno char(10),
credit tinyint check(credit between 1 and 2), --credit
constraint FK_teacher_tno foreign key(tno) references teacher(tno)
)
4.2.4 Create course selection information table
create table grade(
cno char(10),
sno char(10),
gtype char(2) check(gtype in ('zc','bk')), --score type, zc is normal, bk is a make-up test
credit tinyint check(credit between 0 and 100),--score
constraint PK_cno_tno_gtype primary key(cno,sno,gtype),--joint primary key
constraint FK_course_cno foreign key(cno) references course(cno), --外键
constraint FK_student_sno foreign key(sno) references student(sno) --外键
)
4.3 The relationship diagram is as follows
4.4Insert data
--Insert student information
insert into student values('1932101101','2000- 11-10');
insert into student values('1932101102','Yin Yao','Man','15170000002','2001- 10-10');
insert into student values('1932101103','Yu Jun','Male','15170000003','2002- 06-10');
insert into student values('1932101104','Kaguya','Female','15170000004','2003- 11-10');
insert into student values('1932101105','Chenchen','Female','15170000005','2004- 11-10');
--Insert teacher information
insert into teacher values('1000000001','Wang Xin','Female','19170000001');
insert into teacher values('1000000002','Ding','Man','19170000002');
insert into teacher values('1000000003','Li Tao','Male','19170000003');
--Insert course information
insert into course values('zyjc000001','Database Principle','1000000001',2);
insert into course values('zyjc000002','Java Programming','1000000001',2);
insert into course values('zyhx000003','operating system','1000000002',1);
insert into course values('zyhx000004','Computer Network','1000000002',2);
insert into course values('zyjc000005','Principles of Computer Composition','1000000003',1);
insert into course values('zyjc000006','Higher Mathematics','1000000003',2);
--Insert course selection information
insert into grade values('zyjc000001','1932101101','zc',85);
insert into grade values('zyjc000001','1932101102','zc',75);
insert into grade values('zyjc000001','1932101103','zc',65);
insert into grade values('zyjc000001','1932101104','zc',95);
insert into grade values('zyjc000001','1932101105','zc',70);
insert into grade values('zyjc000002','1932101101','zc',85);
insert into grade values('zyjc000002','1932101102','zc',80);
insert into grade values('zyjc000002','1932101103','zc',70);
insert into grade values('zyhx000003','1932101101','zc',85);
insert into grade values('zyhx000003','1932101102','zc',80);
insert into grade values('zyhx000003','1932101103','zc',75);
insert into grade values('zyhx000003','1932101104','zc',70);
insert into grade values('zyhx000003','1932101105','zc',65);
insert into grade values('zyhx000004','1932101101','zc',85);
insert into grade values('zyhx000004','1932101102','zc',70);
insert into grade values('zyhx000004','1932101103','zc',60);
insert into grade values('zyhx000003','1932101104','bk',99);
insert into grade values('zyhx000003','1932101105','bk',94);
4.5.1 Add a student information to the student table
insert into student
values('1932101106','Chen Chang','Female','15170000006');
Data insertion
4.5.2 Modify Chen Chang’s mobile phone number
update student set tel='15170000016' where sno='1932101106';
Data modification
4.5.3 Delete Chen Chang’s personal information
delete from student where sno='1932101106';
Deletion of data
4.6 Data query
4.6.1 Simple query
Query student table information
select * from student;
4.6.2 Nested queries
Query information about the oldest student
select * from student where birth=(select min(birth) from student);
4.6.3 Fuzzy query
Query the information of all students named Hui
select * from student where sname like '辉%';
4.6.4 Connection query
Check the course name and teacher
select c.cname,t.tname
from course c,teacher t
where c.tno=t.tno;
Check the course selection status of student number 1932101104
select * from grade g
left join course c on c.cno=g.cno
where g.sno='1932101104';
4.6.5 Group query
Query the number of courses taught by each teacher
select COUNT(*) as count,tno from course group by tno;
Query the number of elective students in a course
select COUNT(*) as count,c.cno
from course c
left join grade g on c.cno=g.cno
group by c.cno
having c.cno='zyhx000004'
4.6.6 Sorting of queries
Query the grade information of course number zyjc000001 in descending order of grades
select * from grade
where cno='zyjc000001'
order by credit desc;
4.6.7Union function
Statistics of a student’s transcript (total score, average score, number of failing doors)
select
sno,
I AM (believe) I am
AVG(credit) avg,
COUNT(CASE WHEN credit<60 THEN 1 END) as count
from grade
where sno='1932101104'
group by sno;
Statistics on the number of students taking a course, the highest score, the lowest score, and the average grade
select
c.cno,
COUNT(g.sno) count,
MAX(g.credit) max,
MIN(g.credit) min,
AVG(g.credit) avg
from course c
left join grade g on g.cno=c.cno
where c.cno='zyhx000003'
group by c.cno;
4.7 View
4.7.1 Create a score table with information about make-up exams, including all columns
create view v_grade_bk
as
select * from grade where gtype='bk';
select * from v_grade_bk;
4.7.2 Create a course information table containing only professional basic courses
create view v_course_zyjc
as
select * from course where cno like 'zyjc%';
select * from v_course_zyjc;
5. Summary
This experiment in designing a student information management system in the database course gave me a deeper understanding of the concepts and applications of databases. During the experiment, I learned about the specific operations of the database by designing and implementing a student information management system, and clarified the advantages, disadvantages, and application scenarios of the database. At the same time, I also found that many problems occurred during the experiment, including unreasonable database design and unclear application scenarios, which need to be continued to be improved in future study and practice. There are practical operations and practices in various aspects such as conceptual design, logical design and physical design. During the experiment, I encountered many difficulties and problems, such as the table design was not reasonable enough, the index setting was not reasonable enough, the writing of SQL statements was not proficient enough, the index design was not accurate enough, etc. However, through step-by-step solution, I finally designed A stable and efficient student information management system has been implemented. It gave me a deeper understanding of the importance and necessity of databases in information management and application, and also improved my abilities and skills in practical operations. In the following study and practice, I will continue to improve my database skills, constantly improve and challenge myself.