Mobile Web Development tutorial Six, MySQL database basics

Source: Internet
Author: User

One, data type

1. Integral type

Data type storage space description range of values

TINYINT1 byte very small integer with symbolic value: -128~127

Unsigned value: 0~255

SMALLINT2 byte small integer with symbolic value: -32768~32767

Unsigned value: 0~65535

MEDIUMNT3 byte medium-sized integer with symbolic value: -8388608~8388607

Unsigned value: 0~16777215

INT4 byte standard integer with symbolic value: -2147483648~2147483647

Unsigned value: 0~4294967295

BIGINT8 byte Large integer

2, floating point type

Data type storage space description range of values

FLOAT4 bytes But precision floating-point numbers

DOUBLE8 byte double-precision floating-point number

The DECIMAL (m,d) customization is represented as a string

3. String type

Type storage space Description Maximum length

char[(m)]m byte fixed-length string M-byte

varchar[(m)]l+1 byte variable long string M byte

tinyblog,tingtextl+1 byte very small blob and text string 2^8 characters

blog,textl+2 byte small blob and text string 2^16-1 byte

Mediumblob,mediumtextl+3 bytes Medium blob and text string 2^24 bytes

Longblob,longtextl+4 byte large blob and text string 2^32-1 bytes

Enum (' Value ', ' value ') 1 or 2 byte enumeration: Can give an enumeration member 65,535 members

Set (' Value ', ' value ') 1,2,3,4 or 8-byte collection: Multiple members of a collection can be assigned 64 members

4, date and time type data

Type storage space Description Maximum length

Date3 byte yyyy-mm-dd format representation 1000-01-01~9999-12-31

TIME3 byte HH:MM:SS format represents time value -838:59:59~838:59:59

DATETIME8 byte yyyy-mm-dd hh:mm:ss format

TIMESTAMP4 byte YYYYMMDDHHMMSS format indicates timestamp

YEAR1 byte yyyy format year value 1901~2155

Second, the MySQL database operation

1, Login Database

MySQL parameters

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

--delimiter=name Specify Separator

-e,--Vertical Display results vertically

-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. Exit Login

Exit

Quit

Q

3, modify the password

4. Create selection and view database

Creating a Database

Select Database

Deleting content from a database

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.