Database Design of University Textbook Subscription Management System

Summary

With the rapid development of computers and the Internet, more and more industries have realized the informatization and automation of management, and the education industry is no exception. However, in many colleges and universities, the subscription of textbooks, as a very important link in the school teaching work, has not yet fully realized the information management. Therefore, aiming at the difficulties of manual management in the process of college textbook subscription management, this system uses SQLserver 2012 to develop a college textbook subscription management information system to realize the network management of textbook subscription, improve work efficiency, and reduce errors in textbook subscription.

The development of textbook subscription management system mainly includes the establishment and maintenance of database. This system requires the establishment of a library with strong data consistency and integrity and good data security, and requires the application program to be fully functional and easy to use. The system realizes functions such as subscription, purchase and distribution of multi-priced books, bibliographic replacement before arrival, a large number of input work, and bibliographic search.

Key words: textbook subscription database table design

1 System overview 

The textbook subscription management system is an integral part of teaching management, and it is a typical information management system (MIS). The textbook subscription management mode of general schools is handled on the basis of the school year system and class as a unit. With the increasing number of students, the increasing diversification of teaching materials, and the increasing differences in teaching materials among individual students, the management of textbook subscription in colleges and universities has presented a situation that cannot be dealt with. Therefore, it is of great significance and urgency to establish a set of teaching material subscription management mode and management system matching with course selection, and the existing conditions, management concepts and technical level have made it possible.

In order to better adapt to the needs of current school management and avoid the disadvantages of manual management, a teaching material subscription management system has been developed, which can realize the automatic management of teaching material charging and receiving. This system includes four functions, namely, the storage management of teaching materials, Student's book fee management, system management and comprehensive inquiry.

2 Description of the problem

The textbook subscription management system is software that realizes basic functions such as system login and textbook information management. Through research and analysis of existing management models and existing management software, a system model is established. The system must realize functions such as basic information entry, modification, and query ; Realize the statistical analysis function that meets various conditions, and some statistical data should be presented in the form of charts. The textbook subscription management is fully responsible for all the textbook subscription information in the school. It is of positive significance to promote the automation and paperless management of school textbook subscription. The textbook subscription management system is designed for this situation.

The information involved is:

(1) Textbook subscription information. The data items included are: subscription number, book title, publisher, author, edition, unit price, course, major, class, number of people, date, etc.

(2) Teaching material inventory information. The data items included are: subscription number, book title, publisher, author, edition, unit price, quantity, etc.

(3) Textbook purchase information. The data items included are: subscription number, book title, publisher, author, edition, unit price, course, major, class, quantity, date, etc.

(4) Collection information. The data items included are: date, class, amount, etc.

(5) User information. The data items included are: user code, user name, password, birthday, category, etc.

The main function of this system consists of the following parts:

After research and analysis, the textbook subscription management system mainly completes the following functions:

(1) Basic user information module: basic information of users.

(2) Teaching material inventory information module: record the inventory quantity and basic information of teaching materials.

(3) Textbook Subscription Information Module: To inquire about the required textbook subscription information, that is, users can add, modify, delete, and query the subscription information.

(4) Textbook purchase information module: to query the required textbook purchase information, that is, the user adds, modifies, deletes, and inquires about subscription information.

(5) Receipt information module: information on recording the payment status of textbook purchases.

3 Demand Analysis

Requirements analysis is the basis of database design, and its mistakes will affect the entire design. Requirements analysis is also the most tedious and difficult stage for designers.

3.1 Data Flow Diagram

Data flow analysis is to abstract and isolate the flow of data within the organization, leaving out specific organizational structures, etc., in order to discover and solve problems in the data flow. After counting the demand for teaching materials, each department submits the teaching material order to the teaching material management department. The teaching material management department draws up a plan to generate a teaching material schedule, and submits the order form to the supplier in order to ask the supplier to supply the teaching materials and complete the purchase of teaching materials. After work, carry out storage registration, generate storage documents and submit them to the financial department for settlement. Each class will hand in the book list to the teaching material department, and the teaching material department will distribute the teaching materials to each class and register the delivery, generate a delivery list and submit it to the financial department for cost settlement, and generate a textbook cost list.

Its data flow chart is shown in the figure below

 Figure 1 Data flow chart

3.2 Data Dictionary

Table 3-1 Data item description

Data item name: textbook number

Brief description: store the information of each textbook

Brief Description: Coding of School Textbooks

Type and Length: Numeric, 7 digits

Data Value Type: (Continuous/Discrete) Discrete

Table 3-2 Data structure description

Data structure name: teaching material management form

Brief description: A form for storing textbooks in and out of the library, etc.

Data structure composition: subscription number + book title + publisher + author + edition + unit price + course + major + class + number of people + date + operator

Table 3-3 Data processing description   

Working with Logical Names: Making a Plan

Processing number: P1

Brief description: According to the textbook ordering plan of each department and the lack of textbooks.

Input data flow: Textbook order.

Output Data Stream: Textbook Schedule

Table 3-4 Data storage description

Data storage name: library teaching materials

Brief description: Store the basic information of the textbooks in the library.

File composition: subscription number + book title + publisher + author + edition + unit price + quantity.

Data storage name: library textbook

Brief description: Store the basic information of the textbooks out of the library.

File composition: subscription number + book title + publisher + author + edition + unit price + quantity.

Data stream name: textbook storage list

Brief description: Store the basic information of the textbooks in the library.

File composition: subscription number + book title + publisher + author + edition + unit price + quantity.

Table 3-5 Data flow description

Data stream name: teaching material delivery list

Brief description: Store the basic information of the textbooks out of the library.

File composition: subscription number + book title + publisher + author + edition + unit price + quantity.

4 Conceptual structure design

4.1 Entity Analysis Description

From the user's point of view, the needs of the database are mainly reflected in the addition, deletion, modification and query of database tables. Therefore, the database structure needs to meet two elements at the same time: input and output. When doing data design, you first need to collect data, then analyze the data structure, and finally process the data. According to the requirements of this system, the following main data items and data structures are designed:

(1) User information entities: user number, name, gender, major, class, password, date of birth, role, category.

(2) Textbook purchase information entities: subscription number, book title, publisher, author, edition, unit price, course, major, class, quantity, date.

(3) Teaching material inventory information entities: subscription number, title, publisher, author, edition, unit price, quantity.

(4) Textbook subscription information entities: subscription number, title, publisher, author, edition, unit price, course, major, class, number of people, date.

(5) Receipt information entities: date, class, amount.

4.2 Overall ER Diagram

 Figure 2 ER diagram of conceptual structure design

5 Logical structure design

5.1 Relational schema

Relationship mode: user information (user number, name, gender, major, class, password, date of birth, role)

Mode determination: user information ∈ 2NF, and each non-primary attribute does not transfer function depends on the primary relationship key of user information, so user information ∈ 3NF

Relationship model: textbook purchase information (subscription number, title, publisher, author, edition, unit price, course, major, class, quantity, date)

Mode judgment: Textbook purchase information ∈ 2NF, and each non-primary attribute does not have a transfer function dependent on the primary relationship key of textbook purchase information, so textbook purchase information ∈ 3NF

Relationship model: textbook inventory information (subscription number, title, publisher, author, edition, unit price, quantity)

Mode judgment: textbook inventory information ∈ 2NF, and each non-primary attribute does not transfer function depends on the primary relationship key of textbook inventory information, so textbook inventory information ∈ 3NF

Relationship model: textbook subscription information (subscription number, book title, publisher, author, edition, unit price, course, major, class, number of people, date)

Mode judgment: textbook subscription information ∈ 2NF, and each non-primary attribute does not transfer function depends on the primary relationship key of textbook subscription information, so textbook subscription information ∈ 3NF

Relationship mode: collection information (date, class, amount)

Mode judgment: payment information ∈ 2NF, and each non-primary attribute does not transfer function depends on the primary relationship key of payment information, so payment information ∈ 3NF

5.2 Data relationship diagram

As shown in the figure is the relationship diagram generated in the database.

Figure 3 ER diagram of conceptual structure design

 5.3 System relationship diagram

Figure 4 System Relationship Diagram

6 Physical structure design

6.1 Define the database and table name

Database name:

buybook

Database table name:

(1) User information table: s_user

(2) Textbook purchase information form: book_purchase_info

(3) Textbook inventory information table: book_inventory_info

(4) Textbook Subscription Information Form: book_subscription_info

(5) Collection information table: collection_info

6.2 Database storage structure design

In order to improve the performance of the system, according to the application situation, the variable part of the data and the stable part, often

The access part is stored separately from the infrequent access part.

Since today's computers have multiple disks, placing tables (such as user information tables) and indexes on different

In the query process, the efficiency of I/O read and write is greatly improved, and for larger partitions, the two

On a disk, it can speed up the access speed, and it is more effective in a multi-user environment; in order to improve the system

The performance of the log file and the database object (table, index, etc.) are placed on different disks. at the same time,

Considering that this system is multi-user, in order to improve efficiency, the data and log files of the database backup will be kept

stored on disk.

Frequently accessed parts of the database include:

User (user number, name, gender, major, class, password, date of birth, role)

Textbook subscription (subscription number, title, publisher, author, edition, unit price, course, major, class, number of people, date)

Inventory of textbooks (subscription number, title, publisher, author, edition, unit price, quantity)

Textbook purchase (subscription number, title, publisher, author, edition, unit price, course, major, class, quantity, date)

The infrequent access section includes:

Collection of teaching materials (date, class, amount)

In the initial stage of database design, in order to physically optimize the future database, some

The system configures variables, stores distribution coefficients, and assigns reasonable default values ​​to these variables. but these values ​​are not

It must be suitable for each application environment. When performing physical design, reassign these variables to improve

system performance. When choosing hardware devices, server operating systems, and databases, you should consider being able to gradually

Increase and expand.

When configuring system variables, pay attention to the number of users who use the database at the same time, the number of databases opened at the same time

Number of objects, memory allocation parameters, buffer allocation parameters, time slice size, database size, lock

number etc. These parameter values ​​will affect the storage time of the database and the allocation of storage space. 

6.3 Database table structure

Table 6-1 Textbook Purchase Information Form (book_purchase_info)

field name

Field Type

length

primary/foreign key

Field Value Constraints

Corresponding Chinese name

subscription_No

varchar

50

primary key

Not null

subscription number

book_name

varchar

50

Not null

book title

press

varchar

50

Not null

the publisher

author

varchar

50

Null

author

revision

varchar

50

Not null

Edition

unit_Price

varchar

50

Null

unit price

curriculum

varchar

50

Null

course

major

varchar

50

Null

major

class_name

varchar

50

Null

class

buy_Count

char

100

Not null

quantity

buy_date

Date

Null

date

Table 6-2 Textbook Inventory Information Table (book_inventory_info)

field name

Field Type

length

primary/foreign key

Field Value Constraints

Corresponding Chinese name

subscription_No

varchar

50

primary key

Not null

subscription number

book_name

varchar

50

Not null

book title

press

varchar

50

Not null

the publisher

author

varchar

50

Null

author

revision

varchar

50

Not null

Edition

unit_Price

varchar

50

Null

unit price

book_Count

char

100

Not null

quantity

Table 6-3 Textbook Subscription Information Form (book_subscription_info)

field name

Field Type

length

primary/foreign key

Field Value Constraints

Corresponding Chinese name

subscription_No

varchar

50

primary key

Not null

subscription number

book_name

varchar

50

Not null

book title

press

varchar

50

Not null

the publisher

author

varchar

50

Null

author

revision

varchar

50

Not null

Edition

unit_Price

varchar

50

Null

unit price

curriculum

varchar

50

Null

course

major

varchar

20

Null

major

class_name

varchar

20

Null

class

people_Num

varchar

20

Not null

number of people

date_info

date

Null

date

Table 6-4 Collection information table (collection_info)

field name

Field Type

length

primary/foreign key

Field Value Constraints

Corresponding Chinese name

collection_date

varchar

Not null

date

class_name

varchar

20

Not null

class

money

varchar

10

Not null

the amount


Table 6-5 User information table (s_user)

field name

Field Type

length

primary/foreign key

Field Value Constraints

Corresponding Chinese name

user_code

varchar

50

host

Not null

user code

user_name

varchar

50

 null

username

sex

varchar

10

 null

gender

major

varchar

20

 null

major

class_name

varchar

20

 null

class

pwd

varchar

10

 null

password

birthday

varchar

30

 null

Birthday

role_name

varchar

30

 null

Phone number

 

7 Database implementation

7.1 Database Creation

create database buybook

on

( name=work_data,

filename='d:\program files (x86)\sql\buybook.mdf',

size=5,

filegrowth=1

)

log on

( name=work_log,

filename='d:\program files (x86)\sql\buybook_log.ldf',

size=1,

maxsize=50,

filegrowth=10%

)

7.2 数据库表创建

(1)用户表

CREATE TABLE s_user (

user_code  varchar (50)  NOT NULL,

 user_name  varchar (50)  NULL,

 sex  varchar (10)  NULL,

 major varchar (20)  NULL,

 class_name varchar (20)  NULL,

 pwd  varchar (10)  NULL,

 birthday  varchar (30)  NULL,

 role_name  varchar (30)  NULL,

 CONSTRAINT  PK_s_user  PRIMARY KEY CLUSTERED

  1. 教材购买信息表

CREATE TABLE book_purchase_info (

 subscription_No  varchar (50)  NOT NULL,

 book_name  varchar (50)  NULL,

 press  varchar (50)  NULL,

 author  varchar (50)  NULL,

 revision  varchar (50)  NULL,

 unit_Price  varchar (50)  NULL,

 curriculum  varchar (50)  NULL,

 major  varchar (50)  NULL,

 class_name  varchar (50)  NULL,

 buy_Count  varchar (50)  NULL,

 buy_date   date  NULL,

 CONSTRAINT  PK_book_purchase_info  PRIMARY KEY CLUSTERED

  1. 教材库存信息表

CREATE TABLE   book_inventory_info (

 subscription_No  varchar (50)  NULL,

 book_name  varchar (50)  NULL,

 press  varchar (50)  NULL,

 author  varchar (50)  NULL,

 revision  varchar (50 ) NULL,

 unit_Price  varchar (50)  NULL,

 book_Count  char (100)  NULL

)

  1. 教材征订信息表

CREATE TABLE  book_subscription_info (

 subscription_No  varchar (50)  NOT NULL,

 book_name  varchar (50)  NULL,

 press  varchar (50)  NULL,

 author  varchar (50)  NULL,

 revision  varchar (50)  NULL,

 unit_Price  varchar (50)  NULL,

 curriculum  varchar (50)  NULL,

 major  varchar (20)  NULL,

 class_name  varchar (20)  NULL,

 people_Num  varchar (20)  NULL,

 date_info  date  NULL,

 CONSTRAINT PK_book_subscription_info  PRIMARY KEY CLUSTERED

)

(5)用户信息表

CREATE TABLE   s_user (

 user_code  varchar (50) NOT NULL,

 user_name  varchar (50) NULL,

 sex  varchar (10) NULL,

 major  varchar (20) NULL,

 class_name  varchar (20) NULL,

 pwd varchar (10) NULL,

 birthday  varchar (30) NULL,

 role_name  varchar (30) NULL,

 CONSTRAINT  PK_s_user  PRIMARY KEY CLUSTERED

)

7.3 建立存储过程

(1)建立用户表查询存储过程

create procedure s_user

as

begin

    select b.用户编码,

           b.用户名,

           性别,

           专业,

           班级,

           密码,

           生日,

           手机号

    from 用户表 a

end

(2)建立教材购买信息表查询存储过程

create procedure book_purchase_info

as

begin

    select b.征订号,

           b.书名,

           出版社,

           作者,

           版次,

           单价,

           课程,

           专业,

           班级,

           数量,

           日期

    from 教材购买信息表 a

             inner join 用户表 b on a.班级 = b.班级

end

(3)建立教材征订信息表更新存储过程

Create procedure book_subscription_info @班级 char(8), @记录号 int,

@姓名 char(30),@专业 char(10), @人数 char(10),

@日期 datetime

as

    if not exists(select *

                  from 教材征订信息表

                  where 用户编码 = @用户编码)

        Print ('不存在该用户')

    else

        begin

            update 教材征订信息表

            set 征订号=@征订号,

                书名=@书名,

                班级=@班级,

   数量=@数量,

                日期=@日期

            where 用户编码 = @用户编码;

     end

7.4创建触发器

(1) 创建一个触发器,当删除用户信息表时,时也删除其他表中用户的信息。如当删除用户表中信息时,也删除教材征订信息表中的内容,教材购买信息表,收款信息表分别建立此类触发器。

create trigger data_del

    on 用户信息表

    after delete

    as

begin

    delete 教材征订信息表

    where 用户班级 in (select 用户班级 from deleted)

end

(2)建立教材购买信息触发器:

create trigger book_purchase_update

    on 班级

    after update

    as

    declare

        @new_book_purchase_update int, @old_book_purchase_update int

    select @old_book_purchase_update = deleted.征订号

    from deleted

    select @new_book_purchase_update= inserted.征订号

    from inserted

    if ((@new__book_purchase_update - @old__book_purchase_update) > @old__book_purchase_update * 0.15)

        begin

            raiserror ('教材购买过长,取消操作',16,1)

            rollback transaction

        end

(3)建立收款触发器:

CREATE TRIGGER collection_info

    ON 用户信息表

    AFTER INSERT

    AS

BEGIN

    SET NOCOUNT ON;

    Declare @class int;

    Select @class = 班级 From 用户信息表

    IF (@class = null)

        Begin

            Insert into 用户信息表(员工编码, 用户名, 性别, 专业, 班级, 密码, 生日,手机号)

            Select 员工编码, 用户名, 性别, 专业, 班级, 密码, 生日,手机号

            From inserted

        End

    ELSE

        Begin

            print ('用户班级不存在')

            rollback transaction

        END

おすすめ

転載: blog.csdn.net/lf21qp/article/details/131498776