MySQL Learning note one

Source: Internet
Author: User

Learning recently really has gone a lot of detours, learning Metasploit Devil training camp, East learning learn from the West learning nothing has learned. or return simple best, back to think about it, there is a window of the development of windows, how to forget it. So I began to study according to this picture.

a bit large = =.

Start text.

0x01: base operation.

First, create database and table, etc.

CREATE database name;

CREATE table table name (domain name data type column options [,...]) [Charset=utf8];

The column options are as follows:

1. Auto_increment define self-increment sequence

2, PRIMARY key primary key

3. Default ' default ' defines column defaults

4, index definition indexes

5, [NOT] NULL allows/disables NULL

6. CHECK defines the range/options for the values you can enter

7. Unique definition Uniqueness

SHOW TABLES; Displays all the tables.

DESC table name; Displays the structure of the table.

Second, data insertion and display.

INSERT into table name (domain name [,...]) Values (value [,...]);

SELECT domain name [,...] from table name;

0X02: Data manipulation and table operations.

First, insert \ Delete \ update the data.

INSERT into table name (domain name [,...]) Values (value [,...]);

DELETE from table name WHERE conditional expression;

UPDATE table Name set column Name 1 = value 1, column Name 2 = value 2, ... WHERE conditional expression;

Two, the connection of more than one table.

Internal connection: SELECT table name 1. Column name [,...]   Table Name 2. Column name [,...] From table name 1 INNER JOIN table name 2 on table 1. Foreign key = Table 2. primary key;

Outer joins: SELECT table name 1. Column name [,...]   Table Name 2. Column name [,...] From table name 1 left/right OUTER JOIN table name 2 on table 1. Foreign key = Table 2. primary key;

MySQL Learning note one

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.