Solved

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

Posted on 2014-12-21
2
97 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 32

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 45

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

706 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