mysql honeypot_Mysql使用语法总结

查看数据库

show databases;

877f63c4b366d0f42396493c4cf5ad45.png

使用数据库

use honeypot;

查看数据表

show tables;

35f4ce7b69f877897d029fcce9f6f457.png

查看数据表结构

desc TABLEname;

7601805fc591a3e8fc7bfe21f10085cc.png

修改数据表的某个字段的类型

alter table awshoneypot15000

modify type int(10);

从一个数据表awshoneypot1000 中取出前15000行并创建新的数据表awshoneypot15000

create table awshoneypot15000 as select * from awshoneypot1000 limit 15000;

删除某个字段

alter table awshoneypot1000

drop locale;

统计数据表的记录数

select count(*) from awshoneypot;

f1dd3110768b29e282629d5c6e280495.png

没有主键时,添加一列作为主键

alter table tablename add id int(8) not null primary key Auto_increment;

9e971892e0df67666c7c0a088f9050b3.png

修改列的顺序:

移动至第一列:

alter table employee modify user_name varchar(100) first;

9c4103b7915b3cb83aa3c6d554e77f4c.png

把user_name列移动到password后面:

alter table employee modify user_name varchar(100) after password;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值