mysql 常用sql
数据库
> create database db1 default charset utf8;
# 创建db1数据库并指定字符集utf8
> create database if not exists db1 default charset utf8 collate utf8_general_ci;
# if not exists 如果数据库不存在就创建
# collate utf8_general_ci : mysql的字符序遵从命名惯例。以_ci(表示大小写不敏感),以_cs(表示大小写敏感),以_bin(表示用编码值进行比较)> drop database db1;
> drop database if exists db1;数据表
> create table if not exists users (
-> userID int(11) not null auto_increment,
-> username varchar(64) default null,
-> nickname varchar(32) unique default null,
-> age int(11) default null,
-> description varchar(256) default null,
-> primary key (userID)
-> ) engine=MyISAM;table的增删查改
最后更新于