MySQL's learning essay Day1

Source: Internet
Author: User

Basic statement about MySQL

Ps:[] is the default

Created: Create DATABASE db.name

CREATE table name (column name, type, [NULL]) NOT NULL is not required to be empty, not NULL needs to be defined when TABLE is created

Select database: Use Db.name

Show current database: SELECT database ()

Show now exists: Show DATABASES

SHOW TABLES [from Db.name]

Show table data structure: show COLUMNS from Tb.name

Insert record (data): Insert[into] tb.name [(Col.name,...)] VALUES (Val,...)

PRIMARY KEY constraint PRIMARY key has uniqueness, each table can have only one primary key, not NULL

Uniqueness of unique constraint exists, there can be more than one unique in a table, can be NULL, but null in a table can only have one

Default constraint defaults is set default value

Auto-encode (applies int, but can use floating-point number, but not decimal) auto_increment can only be bound on primary key (when the primary key is similar ID, it is convenient to use automatic encoding)

Show Table records: SELECT * from Table.name

MySQL's learning essay Day1

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.