PHP mobile internet development notes (6)-basic MySQL database review _ MySQL

Source: Internet
Author: User
PHP mobile internet development notes (6)-MySQL database basic review recently read some architecture materials, but found that the basic knowledge is not very strong. for the next time, I will summarize the basic knowledge on a regular basis.

I. Data types

1. integer

Data type storage space Description Value range TINYINT1 byte very small integer with the symbol value:-128 ~ 127
Unsigned value: 0 ~ An integer with a smaller value of 255SMALLINT2:-32768 ~ 32767
Unsigned value: 0 ~ 65535MEDIUMNT3 byte integer of medium size with signed value:-8388608 ~ 8388607
Unsigned value: 0 ~ 16777215INT4 byte standard integer signed value:-2147483648 ~ 2147483647
Unsigned value: 0 ~ 4294967295BIGINT8 byte big integer

2. Floating point

Data type storage space Description Value range: FLOAT4 bytes, but the precision floating point number DOUBLE8 bytes double precision floating point number DECIMAL (M, D) custom representation in string form

3. string type

Type bucket description maximum length Char [(M)] M byte fixed length string M byte Varchar [(M)] L + 1 byte variable length string M byte tinyblog, tingtextL + 1 byte very small blob and text string 2 ^ 8 character blog, textL + 2 byte small BLOB and text string 2 ^ 16-1 byte mediumblob, mediumtextL + 3-byte medium BLOB and text string 2 ^ 24 byte longblob, longtextL + 4 byte large BLOB and text string 2 ^ 32-1 byte enum ('value', 'value ') 1 or 2-byte enumeration: a set ('value', 'value'), 2, 3, 4, or 8-byte set can be assigned to an enumerative member: you can assign 64 members to multiple set members.
4. date and time data type description maximum length Date3 byte YYYY-MM-DD format represents 1000-01-01 ~ 9999-12-31TIME3 byte hh: mm: ss format indicates the time value-838: 59: 59 ~ 838: 59: 59DATETIME8 byte YYYY-MM-DD hh: mm: ss format TIMESTAMP4 byte YYYYMMDDhhmmss format represents the timestamp YEAR1 byte YYYY format year value 1901 ~ 2155
II. MySQL database operations

1. log on to the database

Mysql parameters

-D, -- database = name: Open the specified database

-- Delimiter = name specifies the delimiter

-E, -- vertical display result

-H, -- host = name server name

-H, -- html provides HTML output

-X, -- xml provides XML output

-P, -- password [= name] password

-P and -- port = # port number

-- Prompt = name: Set the prompt

-U, -- user = name username

-V, -- version: Output version information and exit

Mysql-h server host address-u user name-p user password

2. log out

Exit

Quit

/Q

3. change the password

4. create, select, and view databases

Create a database

Select database

Delete database content

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.