mysql数据库sql常用命令
2024-10-19 23:24:04
1、查看索引:mysql> show index from tblname;
2、利用索引查询:SELECT * FROM product WHERE ID > =(select id from product limit 866613, 1) limit 20
或者
SELECT * FROM product a JOIN (select id from product limit 866613, 20) b ON a.ID = b.id
3、创建单个索引和联合索引
首先创建一个表:create table t1 (id int primary key,username varchar(20),password varchar(20));
创建单个索引的语法:create index 索引名 on 表名(字段名)
索引名一般是:表名_字段名
给id创建索引:create index t1_id on t1(id);
创建联合索引的语法:create index 索引名 on 表名(字段名1,字段名2)
给username和password创建联合索引:create index t1_username_password on t1(username,password)
最新文章
- C# Memcache分布式缓存简单入门
- 博客建议(Suggestions)
- kinect学习笔记(一)—— Openni平台的搭建~、
- 通过程序校验xml文档学习笔记
- Linux的三种特殊权限
- 【AngularJS】AngularJS 教程
- 【POJ3182】The Grove BFS 最短路径周围
- CRC32 vs Java.HashCode
- 在window上安装redis
- 十年磨一剑 Delphi重新崛起再写传奇
- .net MVC +EF+VUE做回合制游戏(一)
- Zepto源码分析之二(新旧版本zepto.Z方法的区别)
- centos install redmine (项目管理工具)
- C#中foreach命令的使用
- Java ,python面向对象的继承及其区别
- System.Runtime.InteropServices.COMException:“服务器出现意外情况。 (异常来自
- 前端 HTML body标签相关内容 常用标签 定义列表<;dl>;
- 吴裕雄 oracle PL/SQL编程
- 交叉编译Python-2.7.13到ARM(aarch64)平台
- 学习URL地址(待整理)