MySQL数据库基本操作
来源:互联网 发布:进口食品js号 编辑:程序博客网 时间:2024/04/30 09:00
进入数据库;
开始菜单进入MySQL Command Line Client
输入密码
1.查看数据库: show databases;(注意不区分大小写,语句结尾要加上;)
2.进入数据库:use 数据库名称;
3.查看数据库中表的结构:desc 表名称;
4.查看数据库里表的具体内容:select * from 表名;
5.新建表: create table 表名 (
id int,
name char(15),
age int
); // 最基本格式
通用格式:create table [if not exists] 表名称(
字段名1 列类型 [属性] [索引],
字段名2 列类型 [属性] [索引],
字段名3 列类型 [属性] [索引],
字段名n 列类型 [属性] [索引]
)[表类型][表字符集]; //其中属性 包括1.unsigned 2.zerofill 3.auto_incremnet(自动增长)4.null 和not null 5.default
索引 包括1.主键索引primary key(每个表只能有一个) 2.唯一索引unique(防止创建重复的值,可以有多个唯一索引)3.常规索引 (提神数据库的性能)
6.向表中插入数据: insert into 表名 (id,name,age) values(0259,"wuhan",28);
7.修改表: 添加 alter table 表名 add sex char(2) not null;
删除 alter table hehe drop sex;
修改字段名: alter table hehe change name username char(10);
修改列类型:alter table hehe modify username char(15);
8 增删查改:更新: update hehe set age="23" where id>100&&id<2000;
删除:delete from hehe where id>500;
查询语句:select * from hehe where id>500&&id<10000;
- MySql数据库基本操作
- MySQL数据库基本操作
- MySQL 数据库基本操作
- mysql 数据库基本操作
- MySQL数据库基本操作
- 数据库基本操作-mysql
- MySQL数据库基本操作
- MYSQL数据库基本操作
- MySQL 数据库基本操作
- MySQL数据库基本操作
- mysql数据库基本操作
- MySQL数据库基本操作
- mysql数据库基本操作
- 【MySQL】数据库基本操作
- mysql基本数据库操作
- MySQL数据库基本操作
- mysql数据库基本操作
- mysql数据库基本操作
- 物联网跨平台应用开发
- hive启动beeline连接报错: User: xxx is not allowed to impersonate anonymous (state=08S01,code=0)
- AOF后台重写也会造成阻塞
- C语言 指针、结构体、数组
- java基础_day0013_数组
- MySQL数据库基本操作
- border-radius 和 box-shadow前加-moz和-webkit
- 第11期 《Java路上的点滴芬芳》2017年3月刊
- 如何在Ubuntu 14.04上利用Topbeat与ELK收集基础设施指标
- Java 反射的理解
- Android中常用的布局有哪些?
- Error in an XML file: aborting build
- 递归算法
- html文本框不可编辑,禁止用户修改的几种方法