Está en la página 1de 5

Database Concepts

a) Indexing
Indexes are like a dictionary. Suppose there is table like the following with PK, FIRST NAME, LAST NAME,
INDEX. We will create index with last name. So the table will look like the second one for SQL
1 Hari Abhi 2
2 Sheri Mani 1
3 Eld Raj 4
4 Mary Shaji 3

Now Sql can easily search records with last name as they are sorted in alphabetical order. But if there is
any change in record I e modification indexing has to be recalculated. So its expensive for modification
but easy for searching.
When to use indexes:-
Always select an index on column that appears in Where clause of the query.
Only on columns having a high unique number
Avoid indexes on small tables , not highly unique , columns that are not frequently updated ,
large composite index can be costly.
Clustered Index Data stored in the order of index (PK), Un-clustered Opposite of clustered
To create index:- CREATE INDEX index_name ON table_name (column_name)
Keys
Candidate key are the keys which are eligible to be PK.
Primary key is a candidate key that is most appropriate to become main key of the table. From super
key u can remove some fields still it can identify that row. For candidate key if u remove some attributes
it will not identify that row. So candidate key is the subset of the super key.
Composite key is combination of more than one column that uniquely identifies a row.


1 Sheri Mani 2
2 Hari Abhi 1
3 Mary Shaji 4
4 Eld Raj 3

Normalization
Normalization is the process of decomposing tables for eliminating redundancies from database. It will
remove data anomalies. Not normal to have attributed values repeated in database. It becomes difficult
to handle and update the database. Suppose there is a student table with two rows having same names

First NF








Second NF























Third NF







SQL Queries
http://www.studytonight.com/dbms/like-clause.php

SQL Constraints
http://www.studytonight.com/dbms/sql-constraints

Joints
http://www.studytonight.com/dbms/joining-in-sql

Denormalization
In computing, denormalization is the process of attempting to optimize the read performance of
a database by adding redundant data or by grouping data..

También podría gustarte