中国军情
databasename(mysql学习9:创建数据库)

前言:我也是在学习过程中,不对的地方请谅解


show databases;                                    #查看数据库表create database name(数据库名);     #创建数据库drop database name(数据库名);   #删除数据库use name(数据库名);                         #进入数据库show tables;                                  #查看数据库中的表create table  table (id varchar(20),name varchar(50) );           #创建表(表属性)show  create table table;          #查看创建表时候的属性alter table class rename admin1;#修改表名desc  table(表名);                          #查看表结构alter table <表名>  add <新字段名> <数据类型>   #数据库表中添加新字段alter table <表名> change <旧字段名> <新字段名> <数据类型>; #修改表内字段名称alter table <表名> drop <字段名> ; #删除表中某字段insert into table(表名)   values('0001','wangwei');           #表table插入数据0001,wangweiselect * from table;                   # 查看表中所有数据select * from table where id='0001';  #查看表中  配置0001的数据select * from table where id='0001'  and/or  name='wangwei';selsct *from first_t1 where name like "%wan%" limit 1;    #模糊匹配打印限制为1条grant all on firstdb.*  to first@'localhost' identified by'123';  #授权给用户first在本地使用密码123登录firstdb所有的表  权限为all(读写等)drop table table;   #删除表

1、创建2个test的数据库,删除1个创建的数据库

mysql> create database test1;	            //创建测试数据库1,test1mysql> create database test2;	            //创建测试数据库2,test2mysql> drop database test1;	            //删除测试数据库1,test1


mysql学习9:创建数据库nerror="javascript:errorimg.call(this);">

创建和删除数据库


顶一下()     踩一下()

热门推荐

发表评论
0评