In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Write at the front
With regard to the database module, I decided to carefully put each module of the database, such as the basic concept of database, relational model, relational database, relational database standard language SQL, database security, database integrity, database design, database programming. Finally, some relational query processing and query optimization, concurrency control and database management system will be introduced. I will tell you one by one that it may take a lot of time on the way, and the update may not be as fast as you think, so let's move on to the first chapter, the theoretical basis of database. Disclaimer: most of these articles are explained to you in the form of knowledge points, which may not be explained in so much detail.
1 Overview of database system
1.1 basic concepts of database
Data: the basic objects stored in the database when data; the symbolic records that describe things are called data; the meaning of data is called semantics
Database: a collection of organized and shareable large amounts of data stored in a computer for a long time. The data in the database is organized, described and stored according to a certain data model, with less redundancy, high independence and easy expansibility, and can be shared by all kinds of users.
Database system: a system for storing, managing, processing and maintaining data, which is composed of databases, database management systems, applications and database administrators
Database management system: a layer of data management software located between the user and the operating system. Can organize and store data scientifically, obtain and maintain data efficiently; the system structure after the introduction of database:
1.2 functions of the database management system
Data definition function
Data organization, storage and management
Data manipulation
Transaction Management and running function of Database
Database establishment and maintenance function
Realize the communication between different databases
1.3 characteristics of data stored in file system
Data can be preserved for a long time.
Data is managed by the file system
High data sharing and redundancy
Poor data independence
1.4 the characteristics of storing data in database system
Data structure: the data system realizes the structure of the whole data, which is one of the characteristics of the database and the essential difference between the database system and the file system.
High data sharing, low redundancy, easy to expand: data commonality can greatly reduce data redundancy, save storage space, data sharing can also avoid intangibility and inconsistency between data.
High data independence: determined by the secondary image of the database management system
Physical independence: the user's application and the physical storage of data in the database are independent of each other. Storage changes, applications do not change
Logical independence: the logical structure of the user's application and database are independent of each other. When the data logic structure changes, the user program can also remain the same.
The data is uniformly managed and controlled by the database management system: the sharing of the database is concurrent, and when multiple users access it at the same time, it will bring mutual interference among different users.
Database security protection
Check the integrity of the database
Concurrency control
Database recovery
2 data model
Data model is also a kind of model, which is an abstraction of the characteristics of real-world data. Data models are used to describe data, organize data, and manipulate data. Data model is the core and foundation of database system.
2.1 two types of data models
Conceptual model: (conceptual model), also known as information model, it models data and information from the user's point of view, mainly for database design.
Logical model and physical model: logical model mainly includes: hierarchical model, mesh model, relational model, object-oriented model, object-relational data model, semi-structured data model. He models the data according to the viewpoint of computer system, which is mainly used in the implementation of database management system.
The physical model is the lowest abstraction of data, which describes the representation and access methods of data within the system, or the storage and access methods on disk, and is oriented to computer systems.
2.2 terminology in the conceptual model
Entity: a transaction that exists objectively and can be distinguished from each other
Attribute: a property that an entity has
Code: an attribute that uniquely represents an entity
Domain: the range of values for the (domain) attribute
Entity type: abstracts and characterizes similar entities with a collection of entity names and attribute names, for example, students (name, student number.)
Entity set: a collection of entities of the same type. For example, all students are a set of entities.
Connection: the relationship within an entity, which refers to the relationship between the attributes that make up the entity; the relationship between entities refers to the relationship between different sets of entities.
2.3 elements of the data model
Data structure: describes the composition and orientation of the database and the relationships between objects
Data manipulation: a collection of operations allowed by objects (types) and instances (values) in numerical data, including actions and related operation rules.
Data integrity constraints: data integrity constraints are a complete set of rules
2.4 Database Model-- Relational Model
Sample diagram of relational model, where a relationship corresponds to a two-dimensional table, a common term in relational models.
Relation: a relationship corresponds to a table
Tuple (tupe): a row in a table is a tuple
Attribute (attribute): a column in the table
Code (key): also known as a code key, an attribute group in a table that uniquely determines a meta-ancestor
Domain: a field is a collection of values of the same data type
Component: a property value in a tuple
Relational schema: the description of the corresponding relationship; the relational model requires that the relationship must be standardized; each component of the relationship must be an indivisible data item
The advantages of relational models: relational models are strictly based on mathematical concepts
The concept of relational model is single.
The access strength of the relational model is transparent to users, with higher data independence and better security.
Disadvantages of relational model: query efficiency is not as efficient as formatted data model
3 the structure of database system
3.1 three-level mode of database system
Schema: schema, also known as logical pattern, is the description of the logical structure and characteristics of all the data in the database, and is the common data view of all users.
External schema (external schema): external schema, also known as subschema or user mode, is the description of the logical structure and characteristics of local data that database users can see and use, the data view of database users, and the logical representation related to an application.
Internal schema (internal schema): also known as storage mode (storage schema), there is only one internal schema in a database, it is a description of the physical structure and storage of the data, and it is the internal organization of the database. The structure of the three modes is shown below:
3.2 Secondary image of the database
The secondary image of the database is based on the three-tier model of the database system, which provides a two-tier image, as shown in the figure above.
External schema / schema image: the logical independence of the corresponding data. When the schema changes (adding new relationships...) DBA adjusts the external schema / schema image to keep the external schema unchanged, and the application is written according to the external schema of the data, so that the application remains the same.
Schema / internal schema image: there is only one schema and only one schema in the database. When the storage structure of the database changes, DBA makes desired adjustments to the schema / internal schema image to keep the schema unchanged, so that the application does not have to change. It ensures the physical independence of data and programs, which is referred to as the physical independence of data.
4 the composition of the database system
At the beginning of this section, it is introduced that the database system is generally composed of database, database management system, application program and database administrator.
Hardware platform and database: due to the large amount of data in the database and the rich functions of the database management system, the scale of the database itself is also very large, so the requirements for the database are higher.
1) have enough memory to store the operating system, core modules of the database management system, data buffers and applications
2) there are devices such as large enough disks or disk arrays to store databases
3) the system is required to have higher channel capacity to improve the data transmission rate.
Software:
1) Database management system. The database management system is the system software configured for the establishment, use and maintenance of the database.
2) High-level language with database interface and its compilation system
3) the application development tool with database management system as the core. Application development tools are application generators that provide high efficiency and multi-function for application developers and end users.
People: people who develop, manage, and use database systems mainly include database administrators, system analysts and database designers, applications, and end users. Different people involve different levels of data abstraction and have different data views. The data view of each person is shown in the following figure:
Duties of DBA
Determine the content and structure of information in the database
Determine the storage structure and access strategy of the database
Define security requirements and integrity constraints for data
Monitor the use and operation of the database
Improvement, reorganization and reconstruction of database
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.