2

Recently I've asked a question about the best way to go to design a DB schema to support multiple types of users and interactions between them, one of the answers suggested that I use one table for each user type and Distributed Keys.

The thing is the only databases I actively work with are MySQL and SQLite and I've always done this kinda of work of maintaining the integrity of the DB on the programming side and never directly in the database, can someone point me to a detailed yet easy to understand guide on foreign keys, references and related subjects?

Thanks in advance!

EDIT: I'm interested specifically in MySQL usage examples and documentation, I've already searched in the MySQL manual but nothing useful comes up.

Community
  • 1
  • 1
Alix Axel
  • 151,645
  • 95
  • 393
  • 500
  • 1
    don't just limit your search to MySQL specific articles. the basic concepts you are after: tables, Indices, Constraints, Foreign keys, etc. exist is just about all relational databases. there may be slightly different syntax when you implement, but when you are learning about what they are, how to use them, and design, the database engine doesn't really matter. – KM. Aug 14 '09 at 15:02

5 Answers5

2

This isn't MySQL-specific, but there is some good stuff in here http://www.simple-talk.com/sql/database-administration/ten-common-database-design-mistakes/

I don't agree with him about the use of natural keys versus surrogate keys. I have found surrogate keys in general work better for primary keys, but if you have a natural key you should put a unique index on it to prevent duplication of data. Pay particular attention to the sections on:

- Not using SQL facilities to protect data integrity

- Trying to code generic T-SQL objects

- One table to hold all domain values

Another good starting place is: http://www.deeptraining.com/litwin/dbdesign/FundamentalsOfRelationalDatabaseDesign.aspx [dead link Feb 17, 2015]

Rob Bednark
  • 25,981
  • 23
  • 80
  • 125
HLGEM
  • 94,695
  • 15
  • 113
  • 186
1

Try this one: Relational Database Design Basics or the Wiki. Give this a read too.

Specifically related to MySQL:

Also this stackoverflow question: MYSQL and RDBMS

Community
  • 1
  • 1
Mr. Smith
  • 5,489
  • 11
  • 44
  • 60
1

Try these:

Rob Bednark
  • 25,981
  • 23
  • 80
  • 125
KM.
  • 101,727
  • 34
  • 178
  • 212
0

If you like to read books, try Beginning Database Design: From Novice to Professional by Clare Churcher. You can take a look it at google books.

Whoever
  • 33
  • 1
  • 7
0

Hugh Darwen has made his course on Relational Algebra/Database Technology publicly and freely available. Search for "An Introduction to Relational Database Theory" on http://www.thethirdmanifesto.com

It's introductory, so nothing "advanced", but at least you won't be told anything that is an outright violation of the theory.

Rob Bednark
  • 25,981
  • 23
  • 80
  • 125