I picked up the SQL again, searched the PDF of this cainiao-level SQL 21-day self-study pass (thanks to the translator Wang yonghong), and decided to seriously learn it again.
1. SQL Introduction
What is SQL? I still remember that when I learned SQL in college, I thought that SQL is also a language. Like C and C ++, there are corresponding keywords and certain syntax rules. Indeed, SQL is a language. Its full name is structured query language, which was born in the IBM laboratory in the 1970s S. Like many popular development languages, at the beginning of the design, it was only developed for the specific purpose of the specific system, and SQL was initially developed for the IBM DB2 series database. Later, a series of standardized organizations were developed to form a widely used SQL language. Of course, different vendors have also customized SQL statements. The SQL languages of different vendors are slightly different, but in general, many basic SQL statements are quite common.
2. Relational databases
Speaking of SQL, I have to mention relational databases. As the book says, "SQL creates RDBMS". The so-calledRelational DatabaseIt is a database built on a relational model and uses mathematical concepts and methods such as set algebra to process data in the database. In the real world, the relationships between entities and entities are expressed by relational models. The relational model was first proposed by edugatde in 1970 and is in line with the twelve law of cod ". The twelve laws of codd may not be remembered, but we should be clear about the basic features of some relational databases stipulated by these twelve laws, for example, a relational database management system must be able to fully manage databases through its relational capabilities; all information should be explicitly expressed with the value in the table at the logic level. Relying on the combination of the table name, master code, and column name, ensure that each data item in the relational database can be accessed logically. The physical independence of the data, regardless of the database data changes in the storage representation or access method, appliesProgramAnd terminal activities are logically unchanged. According to the definition of codd, "In relational mode, data is stored in a table similar to the structure of a table. This type of table is stored as a row by combining independent data tuples called columns or fields ". the language design of SQL follows or benefits from these rules (let's think about the select, insert, and other statements in SQL ).
3. C/S model and database
The C/S architecture is already common, but I have to say that c/s is indeed a very useful architecture. C/S:
The C/S system is to break down a single task into multiple processors for collaborative processing, just like running on a single processor, a complete client/server system can bind multiple processors together to provide resources shared by a single system virtual environment. special services can access this structure step by step recursion, so a level-1 server can be transformed to a client and require other servers to provide services.
This is also true for our databases. We usually log on to the local database server through a client for maintenance and updates. At the same time, this service model ensures the good universality of the database. We only need to maintain the data on a server, and do not need to adapt the operating system of each platform (that is what the client is doing)
4. ODBC
ODBC (Open Database Connectivity) is an integral part of the database in Microsoft's wosa (Windows Open Services Architecture). It establishes a set of specifications, it also provides a set of standard APIs for database access (application programming interfaces ).
In summary, ODBC is responsible for providing a set of standard interfaces for accessing the database and using drivers for different databases in a unified manner.
Finally, SQL is a non-procedural language that determines what to do rather than how to do it. Databases must meet SQL requirements. This feature is very advantageous in cross-platform and cross-language development environments.