Home  >  Article  >  Database  >  MySQL tutorial relational database

MySQL tutorial relational database

藏色散人
藏色散人forward
2018-11-22 09:59:252323browse

This article mainly introduces the mysql relational database to everyone. I hope it will be helpful to friends in need!

Recommended reference tutorial: "mysql tutorial"

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: data Storage form, two-dimensional table (rows and columns);

  • Operation instruction set: all SQL statements;

  • Integrity constraints: Data constraints within tables (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 Two-dimensional table;

  • Two-dimensional table: consists of header (field name, used to specify the name of the data) and data (actually stored content).

Two-dimensional table example:

##IDEEROR_CODEDESCRIPTION##123Here, if the corresponding field value in the table is empty, the system will still allocate storage space for it, which is why relational databases waste space. !
US0001 This user is not registered
OR0001 Order generation failed
SY0001 Unknown system exception

3 Keyword Description

    DB: 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 structural perspective. From a data perspective.

  • Column\Field:
  • column\field

    , essentially refers to a column (a field) in the table, the column is from the structural point of view, and the field is from From a data perspective.

  • 4 SQL

SQL: 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), represents instructions For
  • create

    , drop and alter etc.

  • DML: Data Manipulation Language, data manipulation language, used to operate data (content in the table). The representative instructions are
  • insert

    , delete and update, etc., but there is a separate classification within DML, namely DQL (Data Query Language), data query language, the representative command is select.

  • DCL: Data Control Language, data control language, mainly responsible for (user) rights management, the representative instructions are
  • grant

    and revoke, etc.

  • SQL is an operation instruction for a relational database. It is a constraint, but not mandatory, similar to W3C, so this means: internal to different database products (such as Oracle and MySQL) There may be some subtle differences.

The above is the detailed content of MySQL tutorial relational database. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete
Previous article:MySQL Tutorial DatabaseNext article:MySQL Tutorial Database