SQL Server from entry to the master (a)

Database infrastructure and database design

First introduce myself - A Zhu, a software engineering school sophomore sister, are trying to learn, but like the old lazy, starting today to push myself to start writing blog, let's learn SQL Server looked at my blog open learning it together, progress together ah.

First, we should learn from the database to find out what's database
database : storage associated with the centralized management of data collection
Special note: If you are familiar with database theory, under the content that can be skipped if you do not contact the database system principle would honestly follow Azhu learn it together, step by step to stabilize the
Well, here we enter the formal learning

1.1 Database System

Database system comprising: a database of hardware and software, database management systems, and database and user database management support system operation. From a user point of view into a single user system configuration database, a master-slave configuration (B / S), the client - server architecture (CS) and distributed architecture
1.1.1 data, information, databases
1. Data: (Data) Description symbol records of a transaction, such as: the numerical data, voice, images and the like.
2. Information: (Information) has a certain meaning, after processing, the data for decision making valuable. Features: Unlimited, sharing, creativity. Information is useful data, is the manifestation of information.
3. Database: (DataBase, DB) long-term storage in the computer, organized, sharable data collection.
1.1.2 Database Management System (DBMS)
he data management software layer situated between the user and the operating system, the main functions are as follows:
1. Data definition function: a data definition language provides the DDL
2. Data manipulation functions: providing a data manipulation language DML (query, insert, delete, modify)
the operation and management 3. database: the establishment of a database, operation, maintenance,
establishment and maintenance functions 4. database: initial data entered into the database, the conversion function, performance monitoring, etc.

1.2 Database System Architecture

1.2.1 System Model Database Concepts
mode (Schema): all described features and data logical structure database, he only relates to the type described does not involve a specific value. The value of a particular pattern called a pattern example (intance)
Note: the reaction pattern of the structure and its associated data, and examples of the reaction to a state of the database at a time
1.2.2 three mode configuration database system
database system structure is divided into three layers: the model, the concept of mode (mode) and an outer pattern

1. Concept Mode (common to all users view):

1. The database is only a conceptual model. The value of many types of records such as composition: department records set of values, a set of recorded values of workers and so on. DBMS described in the form of concept data definition language called "mode DDL" (the Data Schema Definition Language)
2. external mode (visible to the user's view): also known as sub-mode (Subschema) or user mode. The system has a plurality of external modes. User data manipulation language (DML) manipulation of the database is actually outside the external recording mode operation.
3. the mode (storage mode): the physical structure and the description data storage, a database is only a pattern within the
two image data with the function database 1.2.3 Independence
1. Mode outer / conceptual model image: a defined outer mode and the correspondence between the conceptual model. That is the relationship between internal and external recording record.
2. Mode / the mode map: define a correspondence between the conceptual model and the model, and the image data correspondence data structure consisting of two like.
1.2.4 database system user structure
(A Zhu guilty of lazy so 1.2.4 data with other small partners, and beg pardon)

  1. Single-user database system
    such a system, the database system (including application, the DBMS, data) are mounted - on the machine, exclusively by a user, data can not be shared among different machines.
    For example, a company's various departments are using the machine in this sector to manage the data of the department, various departments of the machine is independent. Since the data can not be shared between different departments, so there are a lot of redundant data within the enterprise. For example, the personnel department, accounting department, technology department to store some basic information must be repeated every employee (employee number, name, etc.).

  2. Master-slave configuration
    master-slave structure refers to a structure of a multi-user host with the plurality of terminals. In this configuration, the database system (including application, the DBMS, data) are stored centrally on the host, all processing tasks accomplished by the host, each user terminal to access the database by the host concurrently, share data resources.
    From the main advantage is a simple structure, easy to manage and maintain the data. The disadvantage is that when the number of end-users to a certain extent, the host will be too onerous task has become a bottleneck, so that the system performance significantly. In addition, when a host fails, the entire system can not be used, thus the system reliability is not high.

  3. Distributed architecture
    distributed architecture refers to data in a database is logically a whole, but physically distributed on different nodes of a computer network. Each node in the network can be independently processed data in the local database, performing a local application: while processing the data to be accessed and the plurality of remote databases while performing global application.
    Distributed database system structure is the inevitable product of the computer network development, it adapted to the needs of geographically dispersed companies, groups and organizations for database applications. But the distribution of data storage, to processing, management and maintenance of data difficult. In addition, when users need to access remote data, system efficiency will be significantly constrained by network traffic

  4. Client / server architecture
    master is a general purpose computer system database from each node in a distributed database system and the host machine, and performs both functions DBMS executing the application program. With the increased and widespread use of workstation features, people began to separate DBMS features and applications, network computers on a (some) node is dedicated to executing DBMS feature called database servers, referred to as a server; computer on other nodes DBMS installation of peripheral application development tool that supports user applications, called clients, this is the database system client / server architecture.
    In the client / server architecture, the user of the client's request is transmitted to the database server, database server after treatment, only the results returned to the user (rather than the entire data), thereby significantly reducing the amount of data transmitted on the network, to improve the system performance, throughput and load capacity; on the other hand, the database client / server architecture tend to be more open. General client and server can run on many different hardware and software platforms from different vendors can use database application development tools, applications more portable, but also can reduce software maintenance costs.
    Client / server database system can be divided into centralized server architecture and distributed server architecture. The former is only one database server in the network, the server and the client is more than one. The latter have more than one database server in the network. Server distributed architecture is a combination of client / server and distributed database.
    And master-slave structure similar to the centralized server architecture, the database server to a large number of customers service, they often become a performance bottleneck control system.
    And distributed a similar structure, distribution structure in the server, the data is distributed on different servers, leading to difficult to handle, manage and maintain data.

Original Address: http://blog.sina.com.cn/s/blog_772215060100rk0y.html .

1.3 relational database and design

A Zhu came back guarantee is not lazy. . . . . . (When it is not seen)
1.3.1 relational database
a relationship is a two-dimensional table, the rows and columns as follows:

Full name gender
Joe Smith male
John Doe Female

Note: The line is a unit group (also called a record) from a property is a named attribute name (also known as field names)
1.3.2 Relational Database Design
design is important to directly affect the control of the database management system for data quality would be considered from the following aspects
1. needs analysis
2. conceptual design
3. logical design
4. database tables and standardization of
the link between the database table 5.
here neither the details if you love to learn in detail can understand the reference books, mainly small Azhu lazy. . .

1.3.3 relational database integrity
integrity constraint is to prevent destruction of data outside, thereby reducing the complexity of the application
1. Entity integrity constraints (PRIMARY): each attribute value of the main key field is not null value
2. the only constraint (uNIQUE): in a field constraint can not have the same value appears as student number
3. referential integrity constraints (fOREING): the value of a foreign key value must be derived from a reference table or is null value.Foreign key: F is a basic attribute relationship or one of R, but not a keyword relation R
Estimated that this sentence did not understand, that Azhu to give an example of it on
school enrollment numbers commencement of the table and field numbers alone are not the key elective table, however, students learn number is the primary key table, start number commencement is the primary key table, so the enrollment table relative to the number of school student table is a foreign key, referential integrity constraints require that school enrollment number value in the table must be found in a number of school students table, otherwise, they can take null value.
Table 1.3 Student

student ID Full name gender
S1110 Joe Smith male
S1112 John Doe Female

1.31 Course Table

student ID Commencement No. Achievement
S1110 0101 93
S1112 0102 95

4. Check (the CHECK) and default values ​​(the DEFAULT) constraint

1.4 teaching management database operational tasks

This one does not need to know if you want to know can view the reference
Well this is the first chapter of the preliminary study, like to use praise praise to encourage it Azhu Hee hee hee

Published an original article · won praise 2 · Views 129

Guess you like

Origin blog.csdn.net/m0_46315852/article/details/104458943