Home  >  Article  >  Database  >  What is the basic language of mysql

What is the basic language of mysql

(*-*)浩
(*-*)浩Original
2019-05-09 18:02:384765browse

When we enter mysql, there are actually many basic languages ​​​​of mysql. Let us learn about it today.

Recommended courses: MySQL Tutorial.

What is the basic language of mysql

MySQL is a relational database developed in the 1990s. MySQL 5.0 adds support for views, database stored procedures, triggers, server-side cursors, and Support for advanced features such as distributed transaction protocols.

MySQL advantages: open source, free, cross-platform, high performance, more users

Weaknesses: poor SQL standard compliance.

When facing an unfamiliar database, you usually need a way to interact with it, so you use SQL language.

SQL language is the abbreviation of (Structure Query Language) structured query. It is the use of relationships The database application language of the model. Most relational database systems support the SQL language.

Relational database is a database based on the relational model. The relational model stores and processes data in the form of a two-dimensional table. The relational database A database is a database composed of multiple two-dimensional row and column tables that can be connected to each other.

2. Classification of SQL language.

DDL statement: Data definition Language. Defines different data segments, databases, tables, columns, indexes and other database objects. Commonly used statement keywords include create, drop, alter.

Creation of database

•CREATE DATABASE database name

[CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'] Set the database character set and character set collation rules

•[Example] CREATE DATABASE exam CHARACTER SET 'utf8 ' COLLATE 'utf8_general_ci';

•Switch database: use database name

•[Example]USE exam

Modification of database

alter database exam character set utf8;

Deletion of database

drop database database name

Creation of table

•CREATE TABLE table name (attribute 1 data type [length] [Constraints],...) [ENGINE=INNODB DEFAULT CHARSET=utf8]; (storage engine and character set) such as

Introduction to constraint data types

ENGINE=INNODB DEFAULT CHARSET =utf8; Added when creating the list, Chinese characters can be displayed

Modification of the table

•Alter table Table name

•Add field Alter table add column Column name Type

•Add constraint Alter table table name alter column column name set default 'value';

•alter table table name add constraint primary key name primary key table name (primary key field);

•alter table table name add constraint foreign key name foreign key (foreign key field) references associated table name (associated field);

•Modify field Alter table table name change original field name new field name data type [attribute ];

•Delete field alter table table name drop field name

•Modify constraints alter table table name add constraint foreign key name foreign key (foreign key field) references associated table name (associated field );

Deletion of table

•Drop table table name;

Insertion of table data

•Insert into table name (column 1, column 2,. . . . ) values ​​('a',1,);

Update of table data

•update table name set column name = update value [where update condition];

Deletion of table data

•Delete from table name [where update condition];

DML operation refers to the operation of table records in the database, mainly including the insertion of table records ( insert), update (update), delete (delete), query (select)

The above is the detailed content of What is the basic language of mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn