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

Source: Internet
Author: User

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

td>2^24 bytes
type storage description most Large length
char[(M)] M byte fixed length string M byte
Varc har[(M)] l+1 byte variable-length string M-byte
tinyblog,tingtext l+1 byte very small blob and text string 2^8 characters
blog,text l+2 byte small blob and text string 2^16-1 bytes
mediumblob,mediumtext l+3 byte medium blob and text string
longblob,longtext l+4 byte large blob and text string 2^32-1 byte
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-byte collection: Can be assigned to multiple collection members 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]

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.