MySQL Initial learning

Source: Internet
Author: User
First, signed number and unsigned number

In short, a signed number is a positive negative. Unsigned numbers are only positive.

Second, whether the setting is empty

Default null: defaults to NULL

NOT NULL: null is not allowed

Nothing to write: default is null, that is, the same defalut null

Date Type dates : Day of the month, that is, Xxxx-xx-xxdatetime: years and seconds, that is, xxxx-xx-xx XX:XX:XXtimestamptime: Only time, that is XX:XX:XXyear: only the year, That is XXXX

Example: Build a table with the following fields:

Inserts a row, both the current time.

The following results are performed:

To insert a specified date, the following methods are available:

The result after execution is:

Iv. the difference between char and varchar

Char is similar to varchar, and is used to save short strings in MySQL.

The main difference between the two lies in the different ways of storage:

The length of the char column is fixed to the length that is declared when the table is created, and the length can be any value from 0~255;

The value of the varchar column is a variable-length string, and the length can be specified as 0~255

MySQL Initial learning

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.