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