Thursday 27 August 2015

Database basics


Relational database - A database structured to recognize relations between stored items of information. 

Data redundancy in database means that some data fields are repeated in the database.This data repetition may occur either if a field is repeated in two or more tables or if the field is repeated within the table.Data can appear multiple times in a database for a variety of reasons. For example, a shop may have the same customer’s name appearing several times if that customer has bought several different products at different dates.

Clustered index determines the physical order of data in a table. Only one clustered index is possible per table. But one clustered index can have multiple columns. The data in the table is arranged based on the clustered index column. 

Non-clustered index is like an index in the text book where the data is stored in one place and index is stored in another place.Since the actual data is stored 
separately, one table can have multiple non-clustered indexes just like a text book will have an index for chapters and an index for common words.

The sharing of Resources by multiple users or application programs at the same time is called CONCURRENCY.


Differences between Primary Key and Foreign key:

Primary key uniquely identify a record in the table.
Foreign key is a field in the table that is primary key in another table.

Primary Key can't accept null values.
Foreign key can accept multiple null value.

By default, Primary key is clustered index and data in the database table is physically organized in the sequence of clustered index.
Foreign key do not automatically create an index, clustered or non-clustered. You can manually create an index on foreign key.

We can have only one Primary key in a table.
We can have more than one foreign key in a table.

No comments:

Post a Comment