Why are auto generated indexes always used as primary keys in relational databases? [closed] - database

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed yesterday.
Improve this question
In all the projects I have worked on, every table in a relational database had as its primary key an auto generated index--an integer that is automatically incremented for each new row. Why?
Plus, no foreign key constraints were present. The relationships among tables were faked.
The "senior" developers working alongside me were not able to give me a proper explanation and all they were able to come with were general answers like "Because it is better this way" or "Because it was done this way".

Related

Benefits of Using Datasets [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I understand that datasets contain datatables and that they can house the relationships between those datatables. I am making a simple form that gets data from SQL Server by way of stored procedures that return the records I need subject to certain parameters. It is not strictly necessary that I model relationships between the datables. Are there other benefits of using a dataset to contain them, or am I just as well off to leave them free standing?
For example, you can automatically perform actions on related tables (autodelete). Or you can add restrictions which will depend on such relations.
And it will help you to draw a database diagram.

BodyBuilding Club database, which entities are most important [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How I can come up with an effective BodyBuilding database, what entities are most important?
From which I should be able to come up with an ER diagram. I'm still a novice to databases, but I have read quite enough, most difficult I'm finding a problem with differentiating between a Gym database and BodyBuilding Club database.
Have you tried listing everything you think relates to the database, then removing the ones you don't like, then grouping them in a way that makes sense to you or users of the database?
Certification types, access to bodybuilding books, bodybuilding trainers, ease of super sets, free weight ratios, ratings from heavy lifters, etc.
Try everything, make a list, narrow it down to the items needed for proper function and your business perspective (safety, legal, etc).

Creating relations makes it difficult to edit tables [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
When relations between tables are created it becomes very difficult to edit tables, drop and re-create them. well I decide to leave creating relations for when the job is done and that time its not easy either and later some tables might need modifying again.
what is the best practice for creating foreign keys, and all other relations?
In big projects that I devide project to several small projects, well sometime in one of the smaller projects I see that I have to make a small change to previous small projects. and this ruins everything.
I always create relations when I create my initial database structure, and because it is normally (sometimes... once was...) designed properly, the relations don't tend to change.
What you may find eases any changes to the tables is to change one of the options
In Tools-Options, choose Designers - Table and Database Designers and clear the checkbox marked Prevent saving changes that require table re-creation

Optimizing database for SEO friendly URLs [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am re-asking a question I wrote before the censors closed my question. (I still don't understand why) https://blog.stackoverflow.com/2013/06/the-war-of-the-closes/.
I want to know how to efficiently query a database according to a non-primary key, such as URLs that have no IDs and just a title.
How would this work in terms of indexing?
The original question is here.
You'd still need a candidate key (otherwise, to which database record(s) does a URL refer to?). In terms of indexing, a unique index should be fine to look up URL fragments against it.

Database Design: Creating an association of an association [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have a database design issue and I'm not sure which of my alternatives I should go with.
I have a system that shows a politician's votes on every issue. Users can log in and "support" that politician on each issue. I'm not sure how the associations should work. Here is a picture of two alternatives:
http://i1068.photobucket.com/albums/u447/dmoss18/ScreenShot2012-05-03at111656AM.png
Option 1: A politician has many votes on many issues. A user supports each politician's vote.
Option 2: A user supports a politician on a certain issue (an association table with three foreign keys).
Is option 2 not feasible at all? Is it bad practice to associate three tables in one entity? Which option is considered best practice?
I would prefer option (1) because it shows that the user supports the particular vote. In option (2) it would seem to be possible (without additional constraints) for a user to support a certain politician on a certain issue when that polititian has never voted on it at all! (Of course if that is a desirable possibility then you must go for option (2)).

Resources