mysql数据库基本操作(一)
来源:互联网 发布:服务器提供商 知乎 编辑:程序博客网 时间:2024/05/30 23:11
创建数据库:create database test;
查看数据库:show databases;
使用数据库:use test;
查看当前使用的数据库:select database();
删除数据库:drop database test;(慎用!!!!!!!!!!!!!!)
创建表:create table people(id int primary key auto_increment,name varchar(20) not null,age int(8) not null,brithday datetime);
查看表:show tables;
查看表结构:desc people;
向表中插入一列:alter table people add handsome bool;
查看表结构:desc people;
修改表中字段属性:alter table people modify age int(4);
查看表结构:desc people;
删除列:alter table people drop column handsome;
修改表名:rename table people to information;
查看表:show tables;
复制表:create table copy_information select * from information;
查看表:show tables;
向表中插入数据:insert into information values(1,’张三’,23,’1993-04-12’,True);
查看表中内容:select * from information;
向表中添加多条数据,查看表中内容:select * from information;
删除表中数据:delete from information where name = ‘李四’;
查看表中内容:select * from information;
修改表中数据内容:update information set name=’叶良成’ where name=’李三’;
查看表中内容:select * from information;
创建表时候添加默认注释
CREATE TABLE test(
id int primary key auto_increment comment ‘主键自增’,
name varchar(200) comment ‘姓名’,
) comment=’表注释’;
- mysql数据库基本操作(一)
- MySQL(一)--数据库的基本操作
- mysql数据库基本操作(一)
- 一、MySQL数据库基本操作
- Mysql数据库基本操作(一)
- MySQL数据库基本操作(数据库操作一)
- MySQL数据库基本操作(表的操作一)
- MYSQL基本操作(一)
- MySQL基本操作(一)
- MySql数据库基本操作
- MySQL数据库基本操作
- MySQL 数据库基本操作
- mysql 数据库基本操作
- MySQL数据库基本操作
- 数据库基本操作-mysql
- MySQL数据库基本操作
- MYSQL数据库基本操作
- MySQL 数据库基本操作
- MFC绘图知识大全
- Oracle查看用户下、表下有哪些视图
- PAT乙级1047. 编程团体赛(20)
- Hiberante 单向多对一和一对多的关联映射
- 【HTML5学习笔记】29:CSS3渐变效果
- mysql数据库基本操作(一)
- 如何设置Ubuntu或Redhat下终端窗口的默认大小
- CSS设置页面最大最小宽度
- 【面经笔记】进程调度方式
- Mysql储存过程级建表结构
- Go 输入输出格式化
- JOB:前端面试题3
- 快速破解ViEmu软件
- 奥威Power-BI 集团BI案例:城投集团-集团管理驾驶舱