SQL concepts and development - Geeks time study notes

Learn SQL

Two important standard SQL is SQL92 and SQL99.

SQL language divide

  1. DDL, also known as Data Definition Language, that is, data definition language for defining database objects, including databases, data tables and columns by DDL, you can create, delete, and modify database and table structure
  2. DML, also known as Data Manipulation Language, Data Manipulation Language, use it to operate the database and related records, including add, delete, modify data records in the table.
  3. DCL, also called Data Control Language, Data Control Language, used to define access rights and security levels.
  4. DQL, also called the Data Query Language, data query language, use it to query the desired record, is the top priority of the SQL language, also the focus of learning.

SQL start

SQL is our language and DBMS (database management system) to communicate, before creating the DBMS, it needs to be designed for the RDBMS (relational database management system) is used for the ER diagram (Entity Relationship Diagram), ie entity - relationship FIG designed manner, FIG review by the ER, then the SQL statement or visual management tool (such Navicat) create a data table.

Entity - relationship is a conceptual model to describe the real world, the model has three elements: entities, attributes, relationships.

Entity is an object to be managed, the property is to identify the attributes of each entity, the relationship is the relationship between objects.

SQL-sensitive norms
  1. Table names, alias tables, field names, field alias so lowercase
  2. SQL reserved word, function name, and so bind variable capital

SELECT name, hp_max FROM heros WHERE role_main = '战士'

DBMS Past and Present

The difference between DB, DBS and the DBMS

The English name is DBMS DataBase Management System, database management system, is to manage multiple databases on occasion, it can be understood as DBMS = multiple database (DB) + management program.

English is the DataBase DB, which is a database. The database is a collection of stored data can be understood as a plurality of data tables.

DBS is the English DataBase System, a database system is larger concepts, including the database, database systems and database administrators relationship DBA.

Note that we usually called MySQL, Oracle and other database called accurate, they should be a database management system, which is the DBMS.

DBMS top twenty

? Understanding of the concept of DBMS, what are the current mainstream DBMS see next map is May 2019 DB-Engine rankings released by the DBMS:

Ranking can be seen, a relational database is definitely the mainstream DBMS, the most used DBMS are Oracle, MySQL and SQL Server.

Relational database (RDBMS) is to establish a database, SQL is a query language for relational databases in the relational model foundation.

Relative to SQL, NoSQL refers to non-relational databases, including the database key database on the list, document database, storage and other search engines and columns, in addition also includes a graphical database.

Key databases to store key-value data through the key ways in which key and value can be a simple object, it can be complex objects .key as the unique identifier, things look a little fast, which obviously superior relational database, colleagues shortcomings are obvious, like relational databases can not be as free to use filtering conditions (such as wHERE), if you do not know where to find the data, it is necessary to traverse all the keys, you need to consume a large amount of calculation. key database a typical usage scenario is as content caching. Redis is the most popular type of key database.

Document database used to manage documents in a document database as the basic unit for processing information, a document equivalent to a record, MongoDB is the most popular document database.

Search engines are also important applications database retrieval, full-text search engine has common Elasticsearch, Splunk and Solr. Although relational databases using the search index to enhance the efficiency, but the efficiency is very low for full-text indexing search engine has the advantage of using the full text the technology index, the core principle is "inverted index."

Column database is stored with respect to the line (Row-based) storage line database, Oracle, MySQL, SQL Server database and the like are used, and the column is a database stored in the database in accordance with the data type column, to do so the benefits can significantly reduce the system's I / O, suitable for distributed file systems, lack that function is relatively limited.

Graphics database, use of such a data structure stored FIG relationships between entities (objects). The most typical example is the relationship between the social network of people, mainly the data model of nodes and edges (relation) is achieved, the characteristics of It lies in its ability to solve complex problems efficiently relationship.

SQL and NoSQL camp camp

Many NoSQL classification, key type, document type, search engines, columnar storage and graphics database just mentioned belong to NoSQL camp. Only once before using NoSQL techniques include these come in. Even so, the DBMS rankings or greater proportion of SQL camp, DBMS influence has four of the top five relational database, DBMS top 20 also has a 12 is a relational database. so SQL is still very important.

NoSQL evolution:

  • 1970: NoSQL = We have no SQL
  • 1980: NoSQL = Know SQL
  • 2000: NoSQL = No SQL
  • 2005: NoSQL = Not only SQLL
  • 2013: NoSQL = No, SQL

SQL to NoSQL done a very good complement, so that NoSQL in the present era is still very important.

SQL DBMS camp

In 1979, Oracle 2 was born, it was the first commercial RDBMS (relational database management system), then it was sold to military customers. With growing fame Oracle software, the company also changed their name to Oracle Corporation. In the 1990s, Oracle founder Larry Ellison after Bill Gates to become the second richest man, it can be said IBM created the two empires, a swath through the software industry, Microsoft, and the other is the market leader in enterprise software Oracle. Today, Oracle's annual revenue reached 40 billion dollars, enough to prove the value of commercial database software. From this point we can see that if a large track selection, it is necessary as soon as possible commercialization, occupy large enterprise customers can create tremendous business value, it is enough to prove that a software company does not need to be earned by selling hardware a lot of money.

MySQL is the birth in 1995 of open source database management system, because the characteristics of free and open source, has been a favorite of developers, the rapid growth of users, to become No.1 open source database. But in the development process, MySQL has changed hands twice, first was acquired in 2008 SUN, then in 2010 SUN acquisition by Oracle, so Oracle also has the right to manage MySQL, Oracle so far become the absolute leader in the field of database By. From here we can see that although MySQL is a free product, but the number of users more than enough to prove tremendous customer value. There are a tremendous user value of the products, even if there is no direct commercial value, but as the infrastructure will also be a fancy business leaders.

But while Oracle's acquisition of MySQL, MySQL creator of MySQL has to worry about the risk of closed-source, thus creating MySQL branch project MariaDB, MariaDB and MySQL are compatible in most cases, and added many new features , such as support for more storage engine type. Many companies have turned to the original MySQL MariaDB.

SQL Server is Microsoft's database business development, was born in 1989. In fact, Microsoft also introduced an Access database, it is a desktop database, along with the back-end storage function and front-end interface development, more lightweight, suitable for small application scenarios. Because of the limited storage space background, generally only 2G, Access has the advantage of interface development can be carried out easily at the front desk. And SQL Server is a large database for storing and querying the background, it does not have the interface development capabilities. From here we can see, even if the SQL language is universal, but in order to meet different users' usage scenarios, there will be multiple DBMS. For example, Oracle is more suitable for large multinational corporations, because they are not sensitive to the cost, but have higher requirements for performance and safety requirements, and MySQL but also by many Internet companies, especially in the early start-up companies of all ages.

Oracle as the highest market share of commercial database software, suitable for large multinational corporations, and for lightweight desktop database, we use Access on it. For free open-source products, you can use MySQL or MariaDB. NoSQL camp at the same time, we also need to understand the difference between key type, document type, search engines, columnar databases and graphical database.

DBMS

Guess you like

Origin www.cnblogs.com/wadmwz/p/11023388.html