2) Avoid SELECT DISTINCT. ...
3) Create joins with INNER JOIN (not WHERE)
4) Use WHERE instead of HAVING to define filters
5) Use wildcards at the end of a phrase only
6) Use LIMIT to sample query results.
7) Avoid Nested Queries & Views.
8) Use IN predicate while querying Indexed columns.
9) Use temp tables.
10) Use CASE instead of UPDATE
11) Avoid using OR in JOINS
What are views in the SQL database?
In SQL, a view is a virtual table based on the result-set of an SQL statement. A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database.
What is the use of view?
Views enable us to hide some of the columns from the table. It simplifies complex queries because it can draw data from multiple tables and present it as a single table. It helps in data security that shows only authorized information to the users.
Indexes -
Indexes are special lookup tables that the database search engine can use to speed up data retrieval. In another word, an index is a pointer to data in a table.
An index helps to speed up SELECT queries and WHERE clauses, but it slows down data input, with the UPDATE and the INSERT statements.
No comments:
Post a Comment