Reputation
2,060
Top tag
Next privilege 2,500 Rep.
Create tag synonyms
Badges
8 15
Newest
 Caucus
Impact
~90k people reached

Dec
17
comment What Is The Point of a Primary Key?
@BenBrocka, Are you sure you know what a key is? Uniqueness constraints and indexes are just two possible ways to implement keys - they are not alternatives to keys!
Dec
17
comment What Is The Point of a Primary Key?
@BenBrocka, In SQL DBMSs many operations are difficult or impossible unless you can uniquely identify rows. Whole features may be disabled or crippled without keys. I don't see how you can justify a claim that the "ordinary data manipulation will work fine" without keys. I think there's plenty of evidence that lack of keys and the problem of duplicate rows cost vast amounts of time and money for database customers to fix. The fact that keys and uniqueness are not automatically enforced is the most serious flaw of SQL-based systems and the most difficult problem to solve.
Dec
16
comment What Is The Point of a Primary Key?
One definition (E.F.Codd's) is that a surrogate is a stand in for another key in the same table. Another possible definition is simply that a surrogate key is a key that doesn't mean anything in the external Universe of Discourse. I prefer the second definition.
Dec
16
comment What Is The Point of a Primary Key?
@db2, My point was that we can't reliably say based only a data structure that an auto-incrementing column called Id is "meaningless". It depends how it is being used. If I use it as an order number then that is a "meaningful" key like any other business key. I would recommend not using auto-incrementing columns for such purposes but I've seen plenty of examples where people do use them for meaningful (non-surrogate) business keys.
Dec
16
comment What Is The Point of a Primary Key?
"Does either table have a usable key?" Depends what the key is being used for. I expect you mean that the user is NOT able to use Id to identify books. On the other had if Id is an integer that represents an order number, stock control label/RFID or some other real world identifier that gets assigned to books then it may be usable for the purposes of identifying real books or actual orders or stock. The main disadvantage is that some DBMSs place unreasonable restrictions on the use of key generator columns - only permitting one per table or making them read-only for example.
Dec
16
answered What Is The Point of a Primary Key?
Dec
13
answered Term for a one-row table?
Nov
9
awarded  Enthusiast
Oct
25
comment What is SQL Server Parallel Data Warehouse?
It's not so expensive relatively speaking. PDW is intended to compete with the likes of Oracle Exadata, Netezza, Teradata. The price is pitched accordingly.
Oct
25
answered What is SQL Server Parallel Data Warehouse?
Oct
21
answered Can a 2NF relation be M:M?
Oct
19
awarded  Enlightened
Oct
19
awarded  Nice Answer
Oct
19
comment Is DB Normalization done purely based on the primary key or is it done based on all the candidate keys?
I agree the Elmasri and Navathe explanation is over-complicated - perhaps because their book also covers more than just the relational model. In other contexts (e.g. ER modelling) the idea of designating a "primary" key is given more significance than it is in relational database terms. My own view is that the "primary key" is essentially an outdated concept that should not figure prominently when teaching relational database design. The concept is really worth not much more than a paragraph a footnote.
Oct
19
comment Is DB Normalization done purely based on the primary key or is it done based on all the candidate keys?
@Nabeel, In your example, if BC is a candidate key then B->D is a partial key dependency and therefore R is not in 2NF. If a relation has more than one candidate key then it doesn't matter which you call "primary" - the choice is arbitrary and doesn't make any fundamental or practical difference. What matters is which keys and dependencies you want to be satisfied. Maybe the examples your teacher used only had one key anyway? You will find plenty of examples around that only identify one candidate key per relation.
Oct
19
answered Is DB Normalization done purely based on the primary key or is it done based on all the candidate keys?
Oct
18
comment Should you design the database before the application code is written?
@FabriciO, It depends on the project and many other factors. I disagree that DB changes mean a failure to capture business rules or that the database was not well designed.
Oct
17
comment Should you design the database before the application code is written?
@Fabricio, in an Agile project you do not know for sure what is coming in future sprints. Change doesn't mean failure. If you try to anticipate too much then you create more work for yourself and potentially others too - and put the sprint objectives at risk. You might be able to build stuff in advance but you'd be unwise to assume things will remain static.
Oct
14
answered What are the performance considerations between using a broad PK vs a separate synthetic key and UQ?
Oct
14
comment What are the performance considerations between using a broad PK vs a separate synthetic key and UQ?
+1 for the point that performance has nothing to do with primary keys and everything to do with indexes.