• What is a database
  • Basic Features of Database
  • The data model
  • Database system

What is a database:

Data: Data is the basic object stored in a database.

Database (DB) : it is a structured data set stored in the computer system. It is a collection of related data. The data is managed and maintained by the database management system.

Database management system (DBMS) : a layer of data management software located between the user and the operating system. The DATABASE management system and the operating system are the basic software of the computer.

Database system (DBS) : Database system consists of databases (DB), database management systems (DBMSS), applications and database administrators (DBAs). The system stores, manages, processes, and maintains data.

Basic characteristics of database:

1) Data structuralization: The database system realizes the structuralization of the overall data, which is one of the most important characteristics of the database.

2) Data sharing: because data is integrally oriented, data can be shared by multiple users and multiple applications, which can greatly reduce data redundancy, save storage space and avoid data incompatibility and inconsistency.

3) High data independence: Data independence includes logical independence and physical independence. Logical independence means that the logical structure of data in the database and the application are independent of each other. Physical independence means that changes in the physical structure do not affect the logical structure of data.

4) Unified data management and control: unified data control includes security control, integrity control and concurrency control.

Data Model:

1. Data model components:

(1) Data structure: Data structure in the data model mainly describes the type, content and nature of data as well as the relationship between data. Data structure is the basis of data model, data operations and constraints are built on data structure. Different data structures have different operations and constraints.

(2) Data operations: Data operations in the data model mainly describe the types and modes of operations on the corresponding data structures.

(3) Data integrity constraint: Data constraint in data model mainly describes the grammar, semantic relation, restriction and dependency relation among data in data structure, as well as the rules of dynamic change of data, so as to ensure the correctness, validity and compatibility of data.

A: Classification of data integrity:

① Entity integrity: specifies that each row of a table is a unique entity in the table.

② Field integrity: it means that the columns in the table must meet certain data type constraints, including value range, precision and other provisions.

(3) Referential integrity: refers to the two tables of the main keyword and external keyword data should be consistent, to ensure the consistency of data between the tables, to prevent data loss or meaningless data diffusion in the database.

(4) User-defined integrity: Different relational database systems often need some special constraints according to their different application environments. User-defined integrity is a constraint for a specific relational database, which reflects the semantic requirements that a specific application must meet.

B: Type of integrity constraint:

Table constraint: is a constraint defined in a table. The constraint can be defined at column definition time, when it is called a column constraint, or at table definition time, when it is called a table constraint.

(1) Not NULL constraint: only used to define column constraints.

(2) Unique constraint: The value on the column used to indicate that the unique constraint is created must be unique.

(3) Primary key constraint: used to define the primary key of the base table, which acts as a unique identifier. Its value cannot be null and cannot be repeated to ensure the integrity of the entity.

(4) Foreign key constraint: defines the association between data in one table and data in another table.

(5) Check constraint: used to check the allowable range of field values.

② Domain constraint: A constraint defined in a Domain definition that is related to any column defined in a particular Domain.

Assertion: A constraint defined during an Assertion definition that can be associated with one or more tables.

2. Data model type:

(1) Conceptual data model:

Is a model of the realization world for database users, mainly used to describe the conceptual structure of the world. On the one hand, conceptual model should have strong semantic expression ability and be able to directly express various semantic knowledge in applications. On the other hand, it should also be simple, clear and easy for users to understand.

Among conceptual data models, e-R model, extended E-R model, object-oriented model and predicate model are most commonly used.

(2) Logical data Model:

This is the model that the user sees from the database, is the data model that the concrete DBMS supports, this model should face both the user, also should face the system, mainly use in the realization of database management system (DBMS).

Classification of logical models:

1) Non-relational model:

A: Hierarchical Model: The set of basic Hierarchical relationships that meet the following two conditions is Hierarchical Model

① There is only one node that has no parents. This node is called the root node

② All nodes other than the root have only one parent

B: Network Model: a set of basic hierarchical connections satisfying the following two conditions

① Allow more than one node without parents;

② A node can have more than one parent.

2) Relational Model

(3) Physical data model:

It describes the organization structure of data in storage media. It is not only related to the specific DBMS, but also related to the operating system and hardware.

Database system:

1) Three-level mode structure:

(1) Internal Schema: also known as storage Schema. Description of data physical structure and storage mode is the representation of data in the database.

(2) Conceptual Schema: also known as global Schema. Sometimes referred to simply as “mode.” Is the description of the logical structure and characteristics of all the data in the database;

(3) External Schemas: also called subschemas or user Schemas. Description of logical structure and characteristics of local data that can be seen and used by database users;

2) Two-level mapping:

(1) Conceptual schema/intra-schema mapping

(2) External schema/conceptual schema mapping

3) Physical independence of data:

The mapping between internal schema and conceptual schema provides physical independence of the data. When the physical structure of the data changes, only the mapping between the inner schema and the conceptual schema needs to be changed.

4) Logical independence of data:

The mapping between conceptual schemas and external schemas provides logical independence of the data. When the overall logical structure of the data changes, only the mapping between the external and conceptual schemas needs to be changed to ensure that the application is not affected.

Thank you for reading, if you want to know more basic Knowledge of Java, you can poke me to exchange learning together!