PHP Mobile Internet Development Notes (6)--mysql Database Basics Review [1]

Source: Internet
Author: User

Original address: http://www.php100.com/html/php/api/2014/0326/6707.html


First, the data type

1. Integral type

Data type Storage space Description Range of values
TINYINT 1 bytes A very small integer Signed Value: -128~127
Unsigned value: 0~255
SMALLINT 2 bytes A smaller integer Signed Value: -32768~32767
Unsigned value: 0~65535
Mediumnt 3 bytes A medium-sized integer Signed Value: -8388608~8388607
Unsigned value: 0~16777215
Int 4 bytes Standard integer Signed Value: -2147483648~2147483647
Unsigned value: 0~4294967295
BIGINT 8 bytes Large integer

2, floating-point type

Data type Storage space Description Range of values
FLOAT 4 bytes But precision floating-point numbers
DOUBLE 8 bytes Double-precision floating-point number
DECIMAL (M,D) Custom represented as a string

3. String type

Type Storage space Description Maximum length
char[(M)] M bytes Fixed length string M bytes
varchar[(M)] L+1 bytes Variable long string M bytes
Tinyblog,tingtext L+1 bytes Very small blob and text string 2^8 characters
Blog,text l+2 bytes Small BLOBs and text strings 2^16-1 bytes
Mediumblob,mediumtext L+3 bytes Medium blob and text string 2^24 bytes
Longblob,longtext L+4 bytes Large BLOBs and text strings 2^32-1 bytes
Enum (' Value ', ' value ') 1 or 2 bytes Enumeration: Can be assigned to an enumeration member 65,535 Members
Set (' Value ', ' value ') 1,2,3,4 or 8 bytes Collection: Multiple collection members can be assigned 64 members

4. Date and Time type data

Type Storage space Description Maximum length
Date 3 bytes YYYY-MM-DD format representation 1000-01-01~9999-12-31
Time 3 bytes HH:MM:SS format represents time values -838:59:59~838:59:59
Datetime 8 bytes YYYY-MM-DD HH:MM:SS Format
TIMESTAMP 4 bytes YYYYMMDDHHMMSS format represents timestamps
Year 1 bytes Year value in YYYY format 1901~2155

Second, the MySQL database operation

1. Login Database

MySQL parameters

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

--delimiter=name specifying delimiters

-E,--Vertical Vertical display Results

-H,--host=name server name

-H,--HTML provides HTML output

-X,--XML provides XML output

-P,--password[=name] Password

-P,--port=# port number

--prompt=name Setup Prompt

-u,--user=name user name

-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 selection and view database

Create a database

Select Database

Delete content from the database



PHP Mobile Internet Development Notes (6)--mysql Database Basics Review [1]

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.