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)
- Insert ( inserting Data )
- UPDATE(Modify data)
- 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:
- If a column is required, take it with you.
- Automatic numbering column not filled in, he'll get it automatically.
- 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