首页 > 其他 > 详细

1 简单的命令集合

时间:2018-01-13 12:19:13      阅读:203      评论:0      收藏:0      [点我收藏+]

show databases; 查看数据库

begin; rollback; commit;

use text; 切换数据库
Database changed 数据库已经切换
create database texts; 创建数据库

drop database texts; 删除数据库

create database text default character set utf8 collate utf8_general_ci; 创建数据库+字符集

select * from student; #表的内容

show tables; 查考表

describe student #设计表
或者 desc student;

auto_increment; #自增长

primary key; 主键

alter table student rename student2; 改表名

alter table student add id int ; 增加字段

alter table student change id ids varchar not null; 更该字段名

alter table student drop id ;(删除字段)

alter table student add constraint pk-name primary key student (name); #添加主键

alter table student add constraint fk-name foreign key (id) references person (id); #添加外键

show engines #查看搜索引擎

show variables like ‘storage_engine%‘;

insert into [表名] values (值);#插入数据

create tabel 新表 ( select * from student );

update 表名 ste 列名 = 更新值 where 更新条件;

delete from 表名 where 条件;

truncate table student; #删除字段

select <列名|表达式|函数|常量>
from <表名>
where <条件>
order by <排序的列名> [ ASC 或 DESC]

1 简单的命令集合

原文:https://www.cnblogs.com/L-o-g-i-c/p/8278511.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!