数据库系统 Database System

时间:2021-09-15
本文章向大家介绍数据库系统 Database System,主要包括数据库系统 Database System使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

Overview

In this course we mainly learned about:

  • Relational Database based on Relational Model

  • Database Normalization

  • Database Conceptual Structure Design

一、Relational Database

1. Relational Model

Relational Database supports relational model.

Simply put, a relation is a table.

Row is Tuple. And a column of data is domain.

Normally a relation has a primary key, which can determine a single tuple.

2. Relational Integrity

In relational model, there is a thing called relational integrity, which means the relation has some constraints.

There are there types of integrities:

  • Entity Integrity
  • Referential Integrity
  • User-Defined Integrity

1) Entity Integrity

The value of the primary key cannot be null.

For example, in relation Student:

Student(ID, name, major_id)

ID is the primary key, it can't be null.

2) Referential Integrity

It means:

  • If attribute F is the foreign key of relation R1,
  • and F is the primary key of relation R2,
  • then for each row of R1, the value of F should be null or exist in relation R2.

For example:

Student(ID, name, major_id)
Major(major_id, major_name)

major_id in Student should be null or exist in Major.

3) User-Defined Integrity

It means, user can define the requirements that the data needs to meet.

Like grade: 0~100.

二、Database Normalization

Database Normalization is used to reduce data redundancy.

In relational model, relation has to meet certain requirements. We call it normal form.

Each normal form has its own requirements.

1. 1NF

When no table column has table as values, then the relation is in 1NF.

1NF is the minimum requirement.

2. 2NF

If \(R\in 1NF\),and each non-primary attribute fully functionally depends on any candidate code, then \(R\in2NF\).

3. 3NF

if \(R\in 2NF\),and each non-key attribute of R is a non-transitive dependency of each candidate key of R.

Modern database design meets 3NF at most.

三、Database Conceptual Design

Conceptual design is the key to the entire database design.

Its main task is to establish an independent conceptual model, which reflects the relationships between things in the real world.

Of that we learned about E-R model. E stands for entity, R stands for relation.

We draw E-R diagram to represent the model.

In E-R diagram, rectangle represents entity, ellipse represents attributes of entity, rhombus represents relation.

四、课程设计

The task assigned to me is to make a campus plant management system

For this I need to design a database and at the same time make a user interface.

  • I probably spent two or three days establishing the database.

  • About UI, my initial idea was to build a website.

  • But I can’t learn HTML, CSS and JavaScript in seven days

  • So I decided to learn java in advance, because Java is in the 7th semester.

  • I built a simple user interface using Java Swing, At the same time use JDBC technology to establish a database connection.

But I spend too much time on the UI, so the design of the database is a little simple.

原文地址:https://www.cnblogs.com/danielwong2021/p/15271281.html