Basic Database and basic database tutorial

Source: Internet
Author: User

Basic Database and basic database tutorial
1. The most common data models:
(1) Hierarchical Model: uses a tree structure to represent the relationships between entities and entities.
In a hierarchical model, only one node has no parent nodes, that is, the root node. Nodes other than the root node have only one parent node.
Hierarchical nodes have the following advantages: simplicity and efficiency.
The disadvantage of hierarchical nodes is that they cannot be implemented directly.
(2) mesh model: it allows more than one node to have no parent and one can have more than one parent.
Mesh Model advantages: Multi-to-multiple systems, high storage efficiency.
Disadvantages of the mesh model: the structure is complex and difficult to implement.
Hierarchical and mesh models are non-relational models.
(3) relational model: it consists of a group of relations.
① Relationship: A relationship corresponds to a table (two-dimensional table ).
② Tuples: a row in the table is a tuple.
③ Attribute: a column in the table is an attribute. Name each attribute, that is, the attribute name.
④ Code: an attribute group in the table that uniquely identifies a tuple. For example, a student's student ID can be uniquely identified.
⑤ Field: the value range of the attribute. For example, the Gender domain is (male or female)
Features of the relational model:
① Attribute names are different and all are atomic (no score can be added)
② The Data Types of the same attribute are the same
③ Each row of data (tuples) is not exactly the same.
④ The Order of rows and columns in a table can be arranged in any way, that is, the order of rows and columns does not affect the nature of the table.
(4) object-oriented model
(5) object Relationship Model
2. database language:
DCL Data Control Language (Security)
DDL Data Definition Language (Creation Mode)
DML data manipulation language (data update (add, delete, modify ))
DQL Data Query Language (query)
3. SQL: Structured Query Language, which is the standard language for databases.
SQL verb:
(1) Data Query select
(2) create, drop, and alter data definitions)
(3) insert, update, and delete operations on Data)
(4) Data Control grant and revoke)
4. Data Types
A fixed-length string whose char (n) is n.
Varchar (n) Variable Length string with the maximum length of n
Int long integer
Smallint short integer
Numeric (p, d) is a number. It is composed of p-digit numbers (excluding decimal points and symbols), followed by d-digit digits.
Real depends on the floating point number of the machine's precision
Double precision depends on the double precision Floating Point Number of the machine.
Float (n) floating point number with a precision of at least n digits
Date, including year, month, day, format: YYYY-MM-DD
Time, including the hour, minute, second of a day, in the format of HH: MM: SS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.