数据库基本命令
来源:互联网 发布:拉尼娅王后知乎 编辑:程序博客网 时间:2024/06/06 18:43
show databases; 显示所有已经存在的数据库
create database test; 创建名字为test的数据库
drop database test; 删除名字为test的数据库
use test;使用名字为test的数据库
show tables; 显示这个数据库中的所有数据表
create table player(id int not null auto_increment primary key,name varchar(16) not null,level int not null default “0”,fightingValue int not null default “5”);创建一个名字为player的表,表里一共三列属性id,name,level,fightingValue;
describe player; 显示player这张表的属性
select * from player 遍历这张表的所有数据
insert into player (id,name,level,fightingValue)values (1,”法师”,1,10);增加一行数据
select name from player where id = 2; (查询player这张表中id 为 2 这一行的名字信息)
select * from player order by level asc;对player这张表按等级排序(正序)
select * from player order by fightingValue desc;对player这张表按战斗力排序(倒序)
delete from player where id = 1;删除player这张表中的id = 1的一行数据
update player set fightingValue = 50 where id = 1;更新player这张表中id为1的玩家的战斗力为50;
alter table player add column vipLevel int not null default “0”;增加player表中的一个vipLevel字段,类型为int;
alter table player drop vipLevel;删除player表中的vipLevel字段
alter table player rename as player1;将player这张表的名字改为player1;
mySql支持的常用数据类型:
tinyint,int,varchar,char,float,double
create database test; 创建名字为test的数据库
drop database test; 删除名字为test的数据库
use test;使用名字为test的数据库
show tables; 显示这个数据库中的所有数据表
create table player(id int not null auto_increment primary key,name varchar(16) not null,level int not null default “0”,fightingValue int not null default “5”);创建一个名字为player的表,表里一共三列属性id,name,level,fightingValue;
describe player; 显示player这张表的属性
select * from player 遍历这张表的所有数据
insert into player (id,name,level,fightingValue)values (1,”法师”,1,10);增加一行数据
select name from player where id = 2; (查询player这张表中id 为 2 这一行的名字信息)
select * from player order by level asc;对player这张表按等级排序(正序)
select * from player order by fightingValue desc;对player这张表按战斗力排序(倒序)
delete from player where id = 1;删除player这张表中的id = 1的一行数据
update player set fightingValue = 50 where id = 1;更新player这张表中id为1的玩家的战斗力为50;
alter table player add column vipLevel int not null default “0”;增加player表中的一个vipLevel字段,类型为int;
alter table player drop vipLevel;删除player表中的vipLevel字段
alter table player rename as player1;将player这张表的名字改为player1;
mySql支持的常用数据类型:
tinyint,int,varchar,char,float,double
阅读全文
0 0
- oracle 数据库基本命令
- VFP数据库基本命令
- 数据库基本命令
- MySql数据库基本命令
- MySQL数据库基本命令
- oracle 数据库基本命令
- 数据库基本命令
- 数据库基本命令
- 数据库的基本命令
- 关于数据库基本命令
- 数据库基本操作命令一
- MYSQL数据库基本操作命令
- Oracle数据库基本操作命令
- 数据库基本命令的总结
- Mysql数据库的基本命令
- Oracle数据库基本操作命令
- oracle数据库的基本命令
- Oracle数据库基本操作命令
- jqueryrotate--jQuery旋转插件
- 实验二 Linux用户管理
- 高二&高一&初三模拟赛27 总结
- ORA-01541: system tablespace cannot be brought offline; shut down if necessary
- 单线程,多线程,线程池方法大文件指定单词数量统计
- 数据库基本命令
- Android LockSupport 分析
- BZOJ 1051 [HAOI2006]受欢迎的牛
- K-means++算法思想
- TP5上传图片Call to a member function move() on null
- GoldenGate(4)_问题答疑与部署中的错误记录
- SSL2776 2017年10月19日提高组 整除(容斥+dfs)
- C++实现string类
- bzoj 3173: [Tjoi2013]最长上升子序列