mysql--automatically numbering, adding columns, deleting columns, inserting data, deleting data, modifying data

Source: Internet
Author: User
Tags add time how to add time

At the time of creation

CREATE TABLE si (

Id INT auto_increment

)

Automatic numbering, can not have more than one automatic column (can be automatically coded for you)

If you add a column to it in a S11 form (this is not the same as inserting data)

ALTER TABLE hh2 ADD COLUMN (

Adde INT,

Adder VARCHAR (11)

)

Delete the adde column inside the S11

Alter Table Table name Drop column column name ;

Change structure:

ALTER table name MODIFY The data type to which the column name is to be changed

Change the table name:

ALTER table old table name RENAME new table name

DML Statements (data manipulation statements)
    1. Insert ( inserting Data )
    2. UPDATE(Modify data)
    3. Delete(remove data)

DQL Statement (query statement)

INSERT

Format:

CREATE TABLE Hg (

I INT,

G VARCHAR (100)

)

INSERT into Hg (i,g) VALUES (121, ' 12 ')

Attention:

    1. If a column is required, take it with you.
    2. Automatic numbering column not filled in, he'll get it automatically.
    3. Type description: In addition to the value of no single quotation marks, the others have to add!

How to add Time:

ALTER TABLE Tab_nam ADD COLUMN (

Time1 DATETIME

)

INSERT into Tab_nam (time1) VALUES (Sysdate ())

UPDATE

Format:

UPDATE table name set column = value, column value

Entire column modification

UPDATE table name set sid=sid+1// this Sid is a numeric type

DELETE

Format:

DELETE from table name

Entire table Data Delete

Add conditions can be deleted individually

Encryption:

INSERT into Tab_nam (name1) VALUES (PASSWORD (' 5654 '))

Note The data type length, after encryption, the data will be very long

Why encrypt?

Because save a password or something, can not be seen, if not set directly see the

mysql--automatically numbering, adding columns, deleting columns, inserting data, deleting data, modifying data

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.