添加主键
alter table 表名
add primary key(字段)
添加外键
alter table 父表名称
add constraint 外键名称
foreign key(约束字段) references 子表(约束字段)
内联查询
select 表一.公共字段,其他字段,其他字段
from 表一 inner join 表二
on 表一.公共字段 = 表二.公共字段
如何创建视图
create view 视图名称
as select * from 表名
如何创建和调用存储过程
delimiter //
create procedure 名称(in 参数 参数类型)
begin
select * from table
where 条件
end //
call 过程名称(参数)
更新数据
update 表名 set 字段=数据
删除数据
delete from 表名 where 字段=数据
utf-8和GB2312的区别:
前者为国际通用字符集,后者为简体中文字符集