## 1 Second, the data architecture of SQL database
The data architecture of SQL database is basically a three-tier structure, but the terminology used is different from the traditional relational model. In SQL, relational schema is called "base table"; The storage mode (internal mode) is called "storage file"; The sub-mode (outer mode) is called "view"; A tuple is called a row; This property is called a column. This name is as symmetrical as 00100009a:
## 1 III. Composition of SQL Language
Before learning the SQL language formally, let's have a basic understanding of the SQL language and introduce the composition of the SQL language:
1.SQL database is a collection of tables defined by one or more SQL schemas.
2.SQL table consists of a set of rows, one row is a series of columns, and each column corresponds to a data item.
3. A table can be a basic table or a view. A basic table is a table actually stored in a database, while a view is the definition of a table composed of several basic tables or other views.
4. A basic table can span one or more storage files, and a storage file can also store one or more basic tables. Each storage file corresponds to the last physical file stored externally.
5. Users can query views and basic tables with SQL statements. From the user's point of view, views and basic tables are the same, and there is no difference. It's all relationships (tables).
6.SQL users can be applications or end users. SQL statements can be embedded in programs of host languages, such as FORTRAN, COBOL, PASCAL, PL/I, C and Ada. In an interactive environment, SQL users can also be used as an independent user interface for end users.
## 1 Fourth, operate the database.
SQL includes all operations on the database, which is mainly composed of four parts:
1. Data definition: This part is also called "SQLDDL" and defines the logical structure of the database, including defining the database, basic tables, views and indexes.
2. Data operation: this part is also called "SQLDML", which includes two operations: data query and data update, among which data update includes three operations: insert, delete and update.
3. Data control: The control of users accessing data includes authorization of basic tables and views, description of integrity rules, transaction control statements, etc.
4. Rules for the use of embedded SQL language: rules for using SQL statements in programs in the host language.
Below we will introduce respectively:
##2 (1) data definition
SQL data definition functions include defining databases, basic tables, indexes and views.
First, let's learn about the basic data types provided by SQL: (for example, 00100009b).
Establishment and deletion of 1. database
(1) Establish a database: A database is a data set containing several basic tables, and its sentence format is:
Create database
Among them,
For example, build a project management database (xmmanage), and its statement should be:
CREATEDATABASExmmanage
(2) Delete the database: delete the database and all its contents from the system.
Its statement format is: DROPDATABASE.
Example: Delete the project management database (xmmanage) with the following statement:
DROPDATABASExmmanage
2. Definition and change of basic table
A table that exists independently is called a basic table. In SQL language, a relationship corresponds to only one basic table. The definition of basic table refers to the establishment of basic relational schema, and the change refers to the deletion and modification of existing basic tables in the database.
Thanks