Create a table
CREATE TABLE CeShi1 (Uid varchar (primary) key,pwd varchar (), Name varchar (+), Nation varchar (+), foreign key (Nation) References Nation (Code))
Primary KEY Primary Key
Not NULL non-null
Foreign KEY (Nation) references Nation (Code) foreign key
Auto_increment Self-growth
Note: All symbols must be in the English state
Add a semicolon after each table is created
Do not add a comma after the last column in the table is finished
To delete a table:
drop table Pinpai
Operation of data: CRUD operations
1. Add Data:
INSERT into Brand values (' b001 ', ' BMW 5 '); #第一种方式insert into Brand values (' b002 ') and #第二种方式insert into Pinpai values (' ', ' VW '); #处理自增长列
2. Most simple query
SELECT * FROM Pinpai #查询所有数据select * from Pinpai where Ids = 1; #根据条件查询
3. Modify the data
Update Pinpai Set Name = ' Volkswagen ' where Ids = 4; #修改某一条数据update Car set name= ' Harvard ', Time= ' 2012-3-4 ', price=16,brand= ' b002 ' where code= ' c001 '
4. Delete data
Delete from Brand #删除所有数据delete from Pinpai where Ids = 4; #根据条件删除数据
MySQL Basic operation