12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
mysql数据库 时间:2024-12-03 10:29:15
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
create database if not exists hidb;#创建库,如果此库不存在show warnings;#查看db最近一次的告警alter database hidb character set 'utf-8';#设置数据库字符集drop datab
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
create database if not exists hidb;#创建库,如果此库不存在
show warnings;#查看db最近一次的告警
alter database hidb character set 'utf-8';#设置数据库字符集
drop database testdb; #删除库
show databases like '%db';#查询以db结尾的数据库信息
help show databases;#帮助
create table tbl2 (id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE KEY,name VARCHAR(60) NOT NULL); #创建表结构
create table tbl2 (id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT ,name VARCHAR(60) NOT NULL,UNIQUE KEY(id,name)); #创建表结构
help desc;#帮助
describe city;#查询表结构
DESC tbl2;#查询表结构
show engines;#查看支持的引擎
show table status; #查看所有表状态信息
show table status like 'tablename'\G; #查看单表状态信息
show table status where name like 'table'; #查看以table开头的表
show table status where Engine='MyISAM';#查询引擎为MyISAM的表状态
alter table tbl3 ADD gender ENUM('F','M'); #修改表结构,新增枚举字段
alter table tbl3 CHANGE id stuid SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY;#修改字段名 id 为 stuid
alter table tbl3 ADD INDEX (name); #创建索引
show INDEXES from tbl3;#查看表中的所有索引
alter table tbl3 drop index id;#删除id字段的索引
alter table tbl3 drop primary key id;#删除id字段的主键
create table tbl4 like mysql.user; #创建tbl4表,从mysql.user复制表结构
create table tbl5 select host,user,passwd from mysql.user;#查询mysql.user表中的字段及内容,放到新创建的表中
create index indexname on tabl5(id);#创建索引
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19