码迷,mamicode.com
首页 > 数据库 > 详细

Some SQL basics

时间:2014-07-30 20:15:54      阅读:281      评论:0      收藏:0      [点我收藏+]

标签:os   io   for   cti   ar   sql   table   ui   

Create indexes on one or more columns in a table to help SQL server find the data quickly in a query.

An index helps speed up SELECT queries and WHERE clauses, but it slows down data input, with UPDATE and INSERT statements.

CREATE INDEX index_name
ON table_name (column_name);

CREATE INDEX index_name
on table_name (column1, column2);

You should only add those indexes for which you‘re sure that they‘re necessary. To determine the columns where you could put indexes on, you could:

  • add indexes to columns that are foreign keys
  • add indexes to columns that are often used in where clauses
  • add indexes to columns that are used in order by clauses.

SQL aggregate functions:

AVG(), MIN(), MAX(), COUNT()...

Some SQL basics,布布扣,bubuko.com

Some SQL basics

标签:os   io   for   cti   ar   sql   table   ui   

原文地址:http://www.cnblogs.com/chayu3/p/3878562.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!