database

Database
relational model: regard the world as composed of entities and relationships. The so-called entity refers to the
relational model of things that exist objectively in the real world and can be distinguished from each other. Database: a table-based entity with a primary key A database structure with a foreign key as a relationship between tables
(primari key): use a unique identifier to identify each row; non-repeatable, not null
foreign key (forergn key): used to express the association between tables connect

One-to-one: one master table record corresponds to one slave table record, one slave table record corresponds to one master table record One
-to-many: one master table record corresponds to multiple slave table records, and one slave table record corresponds to one master table record
many pairs Multiple: One master table record corresponds to multiple slave table records, and one slave table record corresponds to multiple master table records (the referenced is the master table)

RDBMS: Relational Database Management System
SQL: Structured Query Language; is a computer language used to manage relational databases and communicate with data in the database.
SQL statement
Data Definition Language (DDL) to create, modify and delete databases. Internal data structure
Data Query Language (DQL) for querying data in the database
Data Manipulation Language (DML) for modifying, querying, deleting, adding
data in the database Data Control Language (DCL) Controlling database access rights

Create database
CREATE DATABASE mytest;
delete database
DROP DATABASE mytest;
create table
CREATE TABLE t_student(
-- primary key indicates that the id column is the primary key column, which cannot be empty or repeated
-- auto_increment sets this column as an active growth column, which is set by dbms Assign the value
id of this column INT PRIMARY KEY AUTO_INCREMENT,
-- varchar(20) This column can only store up to 20 characters
studentName VARCHAR(20),
--
grade INT ,
--
birthday DATE,
-- phone
tel VARCHAR( 20),
className VARCHAR(20)
);
--
DROP TABLE ;

Query all records
SELECT * FROM

delete record
DELETE FROM

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324628591&siteId=291194637