Relational database
1 Definition
Relational database is a database built on a relational model (mathematical model).
As for the relational model, it is a so-called model based on relationships, which includes three aspects, namely:
Data structure: the form of data storage, two-dimensional table (row and columns);
Operation instruction set: all SQL statements;
Integrity constraints: data constraints within the table (fields and fields) and constraints between tables (foreign keys) .
2 Design
Database: Analyze the data requirements that need to be stored. If it is a type of data (entity), it should be designed as a two-dimensional table;
Two-dimensional Table: It consists of a header (field name, used to specify the name of the data) and data (actually stored content).
Two-dimensional table example:
##ID This user is not registered2 ’ s ’ s ’ ’ ‐ ‐ ‐ ‐ ‐ 1 Unknown system exception Here, if the corresponding field value in the table is empty, but the system will still allocate storage space for it, this is also This is why relational databases waste more space!
3 Keyword DescriptionDB: Database, database; DBMS: Database Management System, database management system; DBS: Database System = DBMS + DB, database system; DBA: Database Administrator, database administrator. Row\record: row\record essentially refers to a row (a record) in the table. A row is from a structural perspective, and a record is from a data perspective. Column\field: column\field essentially refers to a column (a field) in the table. The column is from the structural perspective, and the field is from the data perspective. 4 SQLSQL: Structured Query Language, structured query language (data is mainly query, 99% are query operations). SQL is mainly divided into three types: DDL: Data Definition Language, data definition language, used to maintain the structure of stored data (database, table), the representative instructions are create, drop and alter wait. DML: Data Manipulation Language, data manipulation language, used to operate data (content in the table). The representative instructions are insert, delete, update, etc., but there is a separate classification within DML, namely DQL (Data Query Language), data query language, the representative instructions are select.DCL: Data Control Language, data control language, mainly responsible for (user) permission management, the representative instructions are grant and revoke, etc. SQL is an operating instruction for a relational database. It is a constraint, but not mandatory, similar to W3C. Therefore, this means that different database products (such as Oracle and MySQL) may have some subtle internal differences. the difference.The above is the detailed content of Introducing a simple database Database tutorial (2). For more information, please follow other related articles on the PHP Chinese website!