Solved

Cluster, non-cluster index, pk, unique...

Posted on 2014-12-21
2
98 Views
Last Modified: 2014-12-31
At 7:11 min. into this video, at the screenshot below, the explanation is about having cluster, non-cluster index, pk, unique:

https://www.youtube.com/watch?v=ITcOiLSfVJQ

Question: Could you please expand on this discussion and also explain why database safety issue raised here?

index
0
Comment
Question by:Mike Eghtebas
2 Comments
 
LVL 33

Assisted Solution

by:ste5an
ste5an earned 150 total points
ID: 40512026
Imho "saftey" refers to carelessness when creating indices. So a primary key is per default a clustered index in shortened syntax.

See Heaps.
In most cases it's better to have a clustered index on the primary key, cause when it's used in foreign key relations it may avoid additional sorting.

But that's just a guess.
0
 
LVL 46

Accepted Solution

by:
Vitor Montalvão earned 350 total points
ID: 40513005
Only if safety means a way to guarantee the uniqueness of a row (no duplicate rows).
The examples shows the different ways to do that, either using PK (always Unique but can be Clustered or non-clustered) or creating indexes with Unique Constraints (can be also Clustered or non-clustered).
Remember that you can only have one clustered index by table because it's the index that says how your records will be physically ordered.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now