2016.9.23 Summary--database

Source: Internet
Author: User

The relational model sees the world as being made up of entities and connections. The so-called entity refers to something that exists objectively in the real world and can be distinguished from each other.
An entity has an attribute called an attribute, and an entity can be described by several attributes. A database created with a relational model becomes a relational database.
A table is the core unit of a relational database, which is where data is stored.


Primary key: In a relational database, each row is identified with a unique identifier, which is the primary key.
FOREIGN key: In a relational database, a foreign key is used to express the association between a table and a table.

Three types of relationships:
1, one-to-two: a master table record corresponding to a record from the table, while a record from the table also corresponds to a master table record.
2, one-to-many: a master table records corresponding to a number of records from the table, and one from the table records corresponding to a master table record.
3, many-to-many: a master table records corresponding to a number of records from the table, while a record from the table corresponding to a number of main table records. Note: An intermediate table is required to establish a connection between two tables.

A relational database is just a container for storing data, and most databases rely on a software that is a database Management system, or DBS, to manage data in a database. The software that manages the relational database is called the Relational database management system (RDBS).

SQL is a structured query language, a computer language for managing relational databases and communicating with data in a database.
SQL statements:
Data definition Language (DDL): Create, modify, and delete internal data structures for a database
Creating and dropping database creation and drop databases
Create, modify, rename, delete a table, ALTER TABLE, rename table, drop table
Create and delete index creation index, DROP index

Data Query Language (DQL): Queries for data in a database
SELECT statement for Query

Data manipulation Language (DML) is used to modify data in the database, including additions, modifications, deletions, etc.
Insert statement that inserts data into a table
UPDATE statement that updates existing data in a table
To delete a DELETE statement in a table

Data Control Language (DCL): Controlling access to a database
Grant statement that gives the user Sign language access permission
Revoke statement that cancels the user access permission

2016.9.23 Summary--database

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.