Brief description
Part two, lesson 4: database
2. Part two, advance notice of lesson 5: responsive website
Lesson no. 4: database
In terms of “database”, by definition, “data warehouse”。
So one of the main uses of the database is to store data。
Why do we have a database in web
Datab in englishAs an example, simply an electronic file cabinet (where electronic documents are stored), a user can run new, intercept, update, delete, etc. Of the data in the document. It is a data collection that is stored together in a way that is shared by multiple users, has as little redundancy as possible and is independent of the application。
Relationship database and non-relationship data library
Common databases are divided into relationship and non-relationship databases。
The relational database is a database based on a relationship model that handles data in the database using mathematical concepts and methods such as aggregate algebras. The linkages between and among the various entities in the real world are expressed in relationship models. The relationship model was first developed by edgar cod in 1970, in conjunction with the “code xii”。
Non-relationship database, commonly known as nosql (not o)Nly sql, “not just sql”, with the advent of the web2. 0 web site on the internet, the traditional relationship database has become impotent in dealing with web2. 0 sites, particularly the super-large and high-symmetric sns-type web2. 0 pure dynamic site, which has exposed a number of insurmountable problems, while the non-relationship database has developed very rapidly because of its own characteristics. The nosql database was created to address the challenges posed by large-scale data collections of multiple data types, especially the big data application challenges。
Common relationship databases are:
Mysql: a well-known open source database, often used in the blog system. For example, the database that wordpress used in our last lesson is mysql。
Postgresql: mysql competitors。
Sql server: microsoft database. General and ... Net are used in conjunction。
Oracle: oracle's main product. It can be said that it is the head of the relationship database, which is powerful and powerful, but is the most expensive, and that all the general population prefers free mysql. But for many large companies, the oracle database is irreplaceable。
Sqlite: it's easy, as it has a lite in its name. Use in embedded areas is also widespread, such as the voluntary use of sqlite at the beginning of the android system。
There are, of course, many other related databases. Not the best, only the right。
After the relationship database, let's talk about the non-relationship database:
Nosql is divided into four main categories:
Key-value stores databases: this type of database is mainly used in a hashi table, which has a specific key and a pointer pointing to specific data. Key/value models have the advantage of being simple and easy to deploy for it systems. Key/value appears to be inefficient if only partial values are asked or updated by dba. For example: tokyo cabine/ tyrant, redis, voldemort, oracle bdb。
Column storage database: this part of the database is usually used to deal with distributed stored mass data. Keys still exist, but they are characterised as multiple columns. These columns are arranged by the line families. As cassandra, hbPlease, riak。
Document database: the document database is inspired by lotus notes office software and is similar to the first key storage. This type of data model is a versioned document, and semi-structured documents are stored in specific formats such as json. The document database can be considered an upgraded version of the key database, allowing interlocking key values. And document-type databases are more efficient than key-based databases. Couchdb, mongodb. There is also a document-type database, sequiadb, which is already open。
Graphics (graph) databases: unlike other columns and sql databases with rigid structures, they use flexible graphic models and can be extended to multiple servers. Nosql database does not have a standard search language (sql) and data modelling is required for database queries. Many nosql databases have an rst-type data interface or query api. For example: neo4j, infogrid, infoline graph。
The nosql database is more applicable in the following circumstances:
Data models are relatively simple。
More flexible it systems are needed。
The performance of the database is high。
No high data consistency is required。
For given keys, the environment is easier to map with complex values。
Sql language
Unlike the traditional programming language, sql is the abbreviation of structured query language (structuring query query quest), a language between relationship algebra and relationship algorithms proposed by boyce and chamberlin in 1974, and a common and highly functional database language。
So nosql (non-relationship database) does not use sql。
Since data are stored in databases, how do we access them and manipulate them
For relationship databases, we have sql language to help us。
The basic statement of sql is:
Select id, name from users order by id desc
In web development, the dynamic website server has a database, the server sends a "sql query" to the database, the database returns the result (transmitting data), and the server inserts the data received into the corresponding web code。
For example, when i log in with the account number frogoscar, the csdn server will find all the information of the user frogoscar from the numerous tables in the csdn database, then insert it into the generated HTML page, then transmit the web page to my browser, and i will be able to access my own account, and i will be able to operate my personal information: delete, add, modify, search, all of which is done by sql in the csdn database。
You can study the sql series on the w3c website in chinese, with detailed examples:
Http://www. W3school. Com. Cn/sql/index. Asp
Dynamic website
The difference between static and dynamic websites has been explained in the previous course, and we have learned about databases, and we can finally complete the rationale for how dynamic websites work:
Client browser (client) requests a web page from the server。
Servers start to generate web pages。
The server sends sql request to the database。
The database transmits the corresponding data to the server on the basis of sql requests received。
The server takes the data and inserts them on the generated web page。
The final server returns the customized websites (HTML, css and js) to the client。
The client browser explains web pages, so we can see different pages。
Summary
Database: an important tool for data storage. It is divided into relationship databases and the philippines relationship database. More commonly used relationship databases: mysql, oracle, sqlite, etc. You can choose between them something you like。
Nosql (non-relationship database): a large map can be developed in large data and cloud age。
Part two, lesson five
That's all for today. Let's go
Next lesson we learn: responsive websites and mobile applications




