From a career change to do the software, began to contact SQL, but still not very deep, recalling the March when looking for work, left the association did not write out, it is humiliating, to this blog to do a serious start.
In the days to come, when I met the hollow object of a cylinder, I should think of something that was a database. The database is the repository of data. So what is data? Data is People's description of objective things, but data. If the tree has height, how many leaves, green and so on, these are data.
The advent of the computer age has allowed people to stop storing data in paper-like materials, but in memory. How to quickly access our data? People have designed a management system to manage the storage and retrieval of data. Well, this system is the database management system . So now often heard of the relational database management system is this.
The simplest storage unit in a relational database is the table. There is also a "relationship" between the table and the table. This is also the source of the relational database name. Here we are curious, what is this relationship? Relationships are associations, and it's possible to think that a table can find data in another list through some kind of association. This is even an association.
Now let's go inside the table and see what the structure of the table is. The table is divided into rows and columns. Rows are called Records . The columns of the table are fields . Uniqueness can be distinguished by a primary key between rows and rows. For the contents of a cell, it involves the column in which the cell is located, which specifies the specification that restricts all cells in the column, that is, the data type , such as the cell inside the column, only the string, or only the numeric type. In accordance with international conventions on relational databases, the databases produced by each database manufacturer should contain data types of string, numeric, and datetime types. According to my own thinking I summed up the next, is 3+2+1+0. What do you mean?
1, "3" is the string type, numeric type, date Time type. The string type is also divided into variable strings and fixed-length strings depending on whether the length is variable. If a mutable string becomes large, another proprietary noun is defined, which is a large object type, such as a bolb or text data type, which is a binary string, which is a string of text. There is also a string called literal, such as "Hello". Numeric types, such as integers, decimals, floating-point numbers. The date and time type is needless to say.
2, "2" is the null type and bool type.
3. "1" is the custom type supported by the database.
4, "0" like a circle, the circle is similar to the area. I use "0" to refer to a special noun " domain " in a database. A field is a collection of fields or data types that a column can use, and fields are often used in conjunction with constraints, and when you reference a constrained domain, you can more precisely limit the types of data that a column can store.
Well, now we have a basic structure of the database in the mind of a general appearance, is a cylinder, or a chemical plant in a can. Ha ha. There are a lot of two-dimensional tables, which contain a lot of descriptions from the objective world. Now how can people in the distance interact with the jar and use it to access the data? It's going to be a language, a language for people's clients to communicate with the database, which is the SQL language. With this language, a person in the distance, such as Zhang San, who wants to view data from a table in that jar, can send an SQL statement to that tank, and the canister receives and processes the statement, and if there is data, it will be returned and sent to Zhang San. This process is the SQL session . What kinds of Zhang San can be said to be understood by the tank database? There are the following:
A. Data definition Language DDL. is to define what the table is like, what the field is, what the type of the field is, what the table name is, and so on, when the table has only frames and no data is stored in the cell, which means that the number of records is 0.
B. Data Manipulation Language DML. Is the operation language that inserts, modifies, and deletes records into the database.
C. data Query Language DQL. Just don't operate, just look.
D. Data Control Language DCL. This is a language about permissions. Can limit which users can see what data.
E. Data Management commands .
F. transaction control commands .
Specific content, tell.
So far today, good night!!!
(i) Getting Started with SQL