Database MySql Review (1)
A database is an ordered set of a batch of data. The data is stored in some structured tables in different categories, and there is often a cross-reference relationship between data tables, this relationship makes the database also known as the relational database archive cabinet = database, drawer = table, file = record. SQL is the abbreviation of Structured Query Language (Structured Query Language. SQL is a set of operation commands for databases. It is a fully functional database language. When using it, you only need to issue the "what to do" command. The "How to do" command is composed of the SQL syntax that the user does not need to consider.
DML (data manipulation language) queries, inserts, deletes, and modifies data in the database; select, insert, update, and delete; DCL (Data Control Language) the data control language is used to control access permits and access permissions, Grant and revoke, and DDL (Data Definition Language) used to create databases, database objects, and define their columns, such as create table, drop table, and alter table.
Create Database syntax for function functions such as date functions, mathematical functions, character functions, and system functions:
Create database NameDescription: creates a database with a specified name. This statement fails if the database to be created already exists or you do not have the proper permission to create it. For example, create a student library. Mysql> Create Database student; Create Table Syntax:
Create table Name (
Column name 1 column type [<column integrity constraints>],
Column name 2 column type [<integrity constraints of columns>],
......);Description: Create a new data table under the current database. Column Type: indicates the Data Type of the column. Example:
Create a school Table consisting of two columns. The first attribute is not empty and serves as the primary key and auto-increment.Create Table School (school_id int (10) Not null auto_increment primary key, school_name varchar (20 ));
CHAR and VARCHAR typesThe length range of the char and varchar types is 0 ~ The size between 255. The difference between them lies in the way MySQL processes storage: Char regards this size as the exact size of the value (fill the short value with spaces ). The varchar type regards it as the maximum value and only uses the number of bytes actually required by the storage string (an additional byte record length is added ). Therefore, when a short value is inserted into a field of the varchar type, no space is filled (however, a long value is truncated ).
BLOB and TEXTBlob is a large binary object. If you want to store the binary data blob, it is the best choice. Text is the same, but bolb is sorted by binary encoding (case sensitive ), text is sorted by character text mode (Case Insensitive ).
ENUM and SET typesIt is a special string type, and its column values must be selected from a fixed string set. The difference between the two is that the former must be only one of the values, while the latter can be multiple. (Not recommended)