首页 > 代码库 > mysql 语句

mysql 语句

create DATABASE if not exists test_mysql CHARACTER SET utf8;

use test_mysql;

create table if not EXISTS user (
id int(11) not null auto_increment COMMENT ‘自增ID‘,
name VARCHAR(100) not null comment ‘name‘,
age int(4) not null DEFAULT 0 comment ‘age‘,
primary key (id, name)
)
auto_increment=1;

desc user;

show create table user;

show table status like ‘user‘;

select * from user;

ALTER table user modify name VARCHAR(100) not null DEFAULT ‘‘
ALTER table user change name new_name VARCHAR(50) not null DEFAULT ‘‘
ALTER table user add (address VARCHAR(50) not null)
alter table user drop address

TRUNCATE table user;

 

mysql 语句