Some SQL basics

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

上一篇:sql字段中逗号分隔字符串的判断


下一篇:搭建vue开发环境,创建第一个VUE项目,vue的版本环境主要分为2.x以及3.x