Personal Address Book System-Database Course Design

 

 

 

 

 

 

 

 

Course Design

 

Course      database principle and application course design    

Subject          Personal Address Book System          

School of         Information Engineering            

   Professional   Computer Science and Technology                

   Class   18 Engineering College, Class 2                 

   First name  ******                         

   Student number          201805050257             

Instructor            *****                 

 Semester     2019-2020 Second semester    

 

June 5,    2020

 

Zhengzhou Shengda Economic and Trade Management College

Course Design Task Book

Subject personal address book system                                       

Class          2018 Computer Science and Technology Undergraduate Class 2            

Student ID      *************         Name Zhang Zhentao              

Summary

With the development of society, interpersonal relationships have become more and more important. In order to maintain good interpersonal relationships, you must

You must always keep in touch with relatives, friends, classmates, and colleagues, but sometimes there are many restrictions, such as how to find various information about the communication partner? You might think of communication tools such as mobile phones in real life. Due to the singularity of these tools, it is impossible to find the information you want in the first time. Therefore, in order to quickly find contact information and save search time, Develop the address book management system.

 

The address book management system is a personal address book management system based on SQL database storage. It centrally manages the specific information of one's contacts and becomes a small software that is convenient for people to use. In the development process, SQL technology is mainly used. Due to the good use of development tools and databases, it can bring convenience to development and make it an implementable system. So as to achieve the purpose of development-----realize the management of the address book information.

 

Through the use of related technologies, as well as the guidance of teachers and the help of students, all the functions of the system design are realized. Functions include: user login, add contact information, modify contact information, delete contact information, query contact information, you can browse all communication contacts, and you can query the contact you are looking for according to the fields of the data table People and other functions

 

 

 

 

 

 

 

 

 

 

 

 

 

table of Contents

  1.       Demand analysis 1

1.1 System function 1

1.2 System data flow 1

1.3 Data Dictionary 1

2. Database conceptual structure design 4

2.1 Entity Set 4

2.2 Contact Set 4

2.3 Entity attribute graph 4

2.4 Local ER diagram 7

2.5 Global ER Diagram 9

3. Database logic design 9

3.1 The relational model obtained by ER diagram conversion 9

4. Database implementation 10

4.1 Database creation 10

4.2 Database table creation 10

4.2.1 list 10

4.2.2 family table 11

4.2.3 office table 11

4.2.4 listfamily table 12

4.2.5 listoffice table 12

4.3 Data Loading 13

5. Database Access 15

5.1 Data query 15

5.2 Data update 16

6. Database Maintenance 18

6.1 Backing up the database 18

7. Summary 18

8. References 19

 

 

  1. demand analysis

1.1 System function

The data requirements of the address book database system can be obtained by talking with users of the address book system database and the author's analysis of the use of the address book.

· The address book has multiple functions. Each function is built on the created entities and connections, and operations such as adding, deleting, and modifying are realized through entities and connections.

· Users of the address book are identified by their respective entities. The system adds and stores each user's name, phone number, date of birth, and correspondence address, etc., and the user modifies the previously provided communication information when the information is changed.

· While the address book records personal information, it also saves the home address and office address and their corresponding telephone numbers, so that users can be contacted in other ways without timely modification of personal information, so as to achieve multiple choices of data.

· When the address book user manages the address book records, delete and modify useless records and information in time to make the overall structure of the address book clear and natural.

1.2 System data flow

1.3 Data Dictionary

Data structure: list

Meaning description: It is the main data structure of the address book, which defines a record of relevant information

组    成:list_name,list_sex,list_number,list_birthday和list_address

 

Data item: list_name

Meaning description: uniquely identify each record

Alias: Name 

Type: Character

Length: 8

Ranges:

Value meaning: the name of the address book record

Data item: list_sex

Meaning description: uniquely identify each record

Alias: gender

Type: Character

Length: 4

Ranges:

Value meaning: the gender of the recorded person

 

Data item: list_ number

Meaning description: uniquely identify each record

Alias: mobile phone number

Type: Character

Length: 16

Ranges:

Value meaning: the mobile phone number of the recorded person, which is different from the office phone

Data item: list_birthday

Meaning description: uniquely identify each record

Alias: birthday

Type: Character

Length: 8

Ranges:

Value meaning: the birthday of the recorded person

Data item: list_address

Meaning description: uniquely identify each record

Alias: mailing address

Type: Character

Length: 80

Ranges:

Value meaning: the correspondence address of the recorded person

Data structure: family

Meaning description: It is the main data structure of the address book, which defines a record of relevant information

Composition: f_number and f_address

 

Data item: f_number

Meaning description: uniquely identify each record

Alias: Home phone

Type: Character

Length: 16

Ranges:

Value meaning: the home phone number of the recorded person

Data item: f_ address

Meaning description: uniquely identify each record

Alias: Home address

Type: Character

Length: 80

Ranges:

Value meaning: the home address of the recorded person

Data structure: office

Meaning description: It is the main data structure of the address book, which defines a record of relevant information

Composition: of_number, of _address and of_e_mail

 

Data item: of_number

Meaning description: uniquely identify each record

Alias: Office Phone

Type: Character

Length: 16

Ranges:

Value meaning: the office phone of the recorded person

 

Data item: of_address

Meaning description: uniquely identify each record

Alias: office address

Type: Character

Length: 80

Ranges:

Value meaning: the office address of the person being recorded

Data item: of_e_mail

Meaning description: uniquely identify each record

Alias: Email

Type: Character

Length: 20

Ranges:

Value meaning: the e-mail address of the recorded person

 

  1. Database conceptual structure design

2.1 Entity Set

>>>Entity set list, with attributes list_name, list_sex, list_number, list_birthday, list_address.

>>>The entity set family has attributes f_number and f_address.

>>>The entity set office has attributes of_number, of_address and of_e_mail.

2.2 Contact Set

>>>listFamily is a many-to-one connection set between list and family.

>>>listOffice is a many-to-one connection set between list and office.

 

2.3 Entity attribute diagram

List entity diagram

Family entity diagram

Office entity diagram

List family entity diagram

List office entity diagram

 

2.4 Partial ER diagram

List family contact ER diagram

Listoffice contact ER diagram

2.5 Global ER diagram

ER Diagram of Personal Address Book System

  1. Database logic design

3.1 Relational model obtained from ER diagram conversion

As follows (the red font is the main code, the underlined is the foreign code):

list = (list_name,list_sex,list_ number,list_birthday,list_address)

family = (f_number,f_address)

office = (of _number,of _address,of_e_mail)

listFamily = (list_namef _number)

listOffice = (list_nameof _number)

  1. Database implementation

4.1 Database creation

CREATE DATABASE address book;

 

4.2 database table creation

4.2.1list table

CREATE TABLE `list` (

  `list_name` char(8) NOT NULL COMMENT'Username',

  `list_sex` varchar(8) DEFAULT NULL COMMENT'Sex',

  `list_number` char(16) DEFAULT NULL COMMENT'Mobile phone number',

  `list_birthday` varchar(80) DEFAULT NULL COMMENT '生日',

  `list_address` varchar(16) DEFAULT NULL COMMENT'communication address',

  PRIMARY KEY (`list_name`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

4.2.2 family table

CREATE TABLE `family` (

  `f_number` char(16) NOT NULL COMMENT'home phone',

  `f_address` char(80) DEFAULT NULL COMMENT'Home address',

  PRIMARY KEY (`f_number`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

4.2.3office table

CREATE TABLE `office` (

  ʻOf_number` char(16) NOT NULL COMMENT'office phone',

  ʻOf_address` varchar(80) DEFAULT NULL COMMENT'office address',

  ʻOf_e-mail` varchar(20) DEFAULT NULL COMMENT'Office E-mail',

  PRIMARY KEY (`of_number`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

4.2.4 listfamily table

CREATE TABLE `listfamily` (

  `list_name` char(8) NOT NULL COMMENT'Username',

  `f_number` char(16) NOT NULL COMMENT'home address',

  PRIMARY KEY (`list_name`,`f_number`),

  KEY `listfamily_ibfk_2` (`f_number`),

  CONSTRAINT `listfamily_ibfk_2` FOREIGN KEY (`f_number`) REFERENCES `family` (`f_number`) ON DELETE CASCADE ON UPDATE CASCADE,

  CONSTRAINT `listfamily_ibfk_1` FOREIGN KEY (`list_name`) REFERENCES `list` (`list_name`) ON DELETE CASCADE ON UPDATE CASCADE

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

4.2.5listoffice table

CREATE TABLE `listoffice` (

  `list_name` char(8) NOT NULL COMMENT'Username',

  ʻOf_number` char(16) NOT NULL COMMENT'office address',

  PRIMARY KEY (`list_name`,`of_number`),

  KEY `of_number` (`of_number`),

  CONSTRAINT `listoffice_ibfk_1` FOREIGN KEY (`list_name`) REFERENCES `list` (`list_name`),

  CONSTRAINT `listoffice_ibfk_2` FOREIGN KEY (`of_number`) REFERENCES `office` (`of_number`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

4.3 Data loading

List table data

-- ----------------------------

-- Records of list

-- ----------------------------

INSERT INTO `list` VALUES ('Zhang San','Male', '13807388888', '19910706','Henan Xinzheng');

INSERT INTO `list` VALUES ('Wang Ke','Female', '15207383333', '19901101','Henan Xinzheng');

INSERT INTO `list` VALUES ('Guo Hao','Male', '15807387777', '19900123','Henan Xinzheng');

INSERT INTO `list` VALUES ('Ma Zhuang','Male', '13407389999', '19891203','Henan Xinzheng');

Family table data

-- ----------------------------

-- Records of family

-- ----------------------------

INSERT INTO `family` VALUES ('0731245677','Henan Xinzheng Building 32');

INSERT INTO `family` VALUES ('07382456777','Henan Xinzheng No. 31 Building');

INSERT INTO `family` VALUES ('07412456777','Henan Xinzheng Building 33');

Office table data

-- ----------------------------

-- Records of office

-- ----------------------------

INSERT INTO ʻoffice` VALUES ('0103333333','Beijing Dongcheng District','[email protected]');

INSERT INTO ʻoffice` VALUES ('07381111111','Henan Xinzheng', '[email protected]');

INSERT INTO ʻoffice` VALUES ('07382222222','Henan Xinzheng','[email protected]');

INSERT INTO ʻoffice` VALUES ('07554444444','Guangdong Shenzhen','[email protected]');

Listfamily table data

-- ----------------------------

-- Records of listfamily

-- ----------------------------

INSERT INTO `listfamily` VALUES ('郭豪', '0731245677');

INSERT INTO `listfamily` VALUES ('王可', '07382456777');

INSERT INTO `listfamily` VALUES ('马庄', '07382456777');

INSERT INTO `listfamily` VALUES ('张三', '07412456777');

listoffice table data

-- ----------------------------

-- Records of listoffice

-- ----------------------------

INSERT INTO `listoffice` VALUES ('王可', '0103333333');

INSERT INTO `listoffice` VALUES ('马庄', '07381111111');

INSERT INTO `listoffice` VALUES ('郭豪', '07382222222');

INSERT INTO `listoffice` VALUES ('张三', '07554444444');

  1. Database access

5.1 Data query

Query "Zhang San"'s mobile phone number, birthday and address

select list_name,list_number,list_birthday,list_address from list where list_name="张三";

Check the office phone number, mobile phone number and birthday of "Ma Zhuang"

select list.list_name,list_number,list_birthday,of_number from list inner join listoffice on list.list_name=listoffice.list_name where list.list_name="马庄";

5.2 Data update

1 If Wang Ke’s birthday is 19901101, she changes her mobile phone number to 18003933800 and her name is Wang Lao Wu

The execution is as follows: update list set list_name="王老五",list_number=18003933800 where list_birthday=19901101;

2 If the user's friend Ma Zhuang has gone abroad, this contact method is not available, and the user wants to delete the Ma Zhuang information

The execution is as follows: delete from list where list_name="马庄";

  1. database maintenance

6.1 Backup database

Export database

Mysqldump-uroot-pdatabasetable>*sql

Import database

Mysql-u username -p database name<database file

  1. to sum up

Through this course design, we have a deeper understanding of database principles, and practice allows us to see the importance of the knowledge we have learned more clearly. In the course of designing the course, I found many shortcomings of my own. The knowledge that I did not usually master was completely exposed in this experiment. After constant thinking, constant review of information and operation on the computer, most of the problems were solved. Of course, there are still some problems that have not been solved. We believe that we can solve them well in the future. they. After two weeks of hard work, with the help of the teacher, through my own efforts and quoting from the materials, I finally completed the simple course design of this personal address book system. The hard work pays off, as long as you work hard, you will get a good return.

Although the difficulty of the course design chosen this time is relatively small, we have achieved it step by step through our own efforts. All in all, we have learned a lot from this, and I think this course design will be of great help to my future work.

 

 

  1. references

[1] Wang Shan, Sa Shixuan. "Introduction to Database System" [M]. Beijing: Higher Education Press, 2006.5

[2] He Yujie. "Database Principles and Applications"[M]. Machinery Industry Press, 2009.7

 

 

 

Guess you like

Origin blog.csdn.net/weixin_43730875/article/details/106872427