mysql 在cmd模式下的命令

show databases;显示所有数据库
use test;使用名为test的数据库
show tables;显示test下的表的信息
desc info;显示info表的具体表结构
select * from info; 选择info表中所有内容
insert into info values (1,‘张杰’,17);插入一条信息
insert into info (ID, Name,adrres) values (1,‘张杰’,18);与上面是一样子的
drop from info ;清除表中内容
quit;//退出数据库

create database test;创建名为test的数据库

//
创建名为info的表
create table info(id int , name varchar(20), age int);
drop table info;删除表

//修改表的名字
alter或者rename来实现
alter table old_name rename to new_name
alter table info rename to student; info表改名为student
或rename table old_name to new_name
rename table info to student;

//增加表的字段
alter table table_name add column_name column_type
//修改字段名字
通过命令alter table table_name change column_name new_column_name new_column_name_type
//删除字段
通过命令alter table table_name drop column_name;

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值