Database MySQL Review (1)

Source: Internet
Author: User
Tags mathematical functions


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 types
The 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 types
It 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)

 

 

Related Article

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.