#创建表#
drop table if exists tb_user;
CREATE TABLE tb_user (
user_id VARCHAR(60) not null PRIMARY KEY,
user_name VARCHAR (60) not null,
user_level INT DEFAULT 1 not null,
user_password VARCHAR (100) not null,
user_email VARCHAR (50) NULL ,
user_sex bit DEFAULT 0 NULL,
user_age INT NULL
)
#额外添加主键#
Alter table tabname add primary key(col)
#添加外键#
alter table tb_user add constraint key_id foreign key(user_id) REFERENCES tb_stu(id)
#删除外键#
alter table tableName drop foreign key key_id
#插入#
insert into table1(field1,field2) values(value1,value2)
示例:insert into table_a(a) values("已连接")
#更新#
update table1 set field1=value1 where 条件
#删除#
delete from table1 where 范围
#查询#
select * from table1 where 范围
#参考链接#
https://www.cnblogs.com/jondam/p/6259666.html
https://www.cnblogs.com/yunf/archive/2011/04/12/2013448.html