Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Databases > Re: MySql - cre...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 5 Topic 3687 of 3876
Post > Topic >>

Re: MySql - creating a schema.

by Martin Gregorie <martin@[EMAIL PROTECTED] > Mar 27, 2008 at 12:58 AM

On Wed, 26 Mar 2008 16:20:51 +0200, Mr. X. wrote:

> 2. How can I create my own schema ?
> 
I'd suggest you get a good book on database design and get to grips with
the principles of Entity-Relation****p modelling and normalisation. The
schemas of virtually all good databases are designed this way:

- use your knowledge of the material the database is going to model to
  select the entities - rather like you decide on the major cl***** for a
  new Java project.

- decide how the entities are related and use this to draw an entity
  relation****p diagram.

- meanwhile collect attributes for each entity and decide which
  are identifiers. Determine the unique identifier.

- normalise the entities to 3rd normal form and, preferably, get rid of
  derived values. This step is critical to designing a good schema.

- after normalisation the attributes will become columns in one or
  more tables which together represent the entity. The identifiers become
  the prime keys of the table(s).

- now project the prime keys down relation****ps in the 1:many
  direction and add them to the 'many' table as foreign keys.

- code up the tables in sql to define the database. Add indexes
  to sup****t the prime keys and your first cut schema is done.

- during development you should run queries manually before building
  them into programs and use the database's query analyser to
  determine if any extra indexes are needed. Be sparing. Indexes can 
  be expensive to maintain and very greedy for disk space.

I prefer to hold the schema as a single file with DROP statements
appearing before the CREATE statements because you can run it as 
a single script script and know you haven't forgotten anything. 
Ordering is critical: toy MUST define master tables before details or the
schema won't build and you MUST use the reverse sequence for DROP
statements. Keep editing and running the schema against an empty database
until it runs without errors.

Books? I personally like those by Chris Date. They are old now, but the
principles haven't changed. They are easy to read, have lots of examples,
and explain stuff pretty clearly.

HTH


-- 
martin@[EMAIL PROTECTED]
   | Martin Gregorie
gregorie. | 
org       | Zappa fan & glider pilot
 




 5 Posts in Topic:
MySql - creating a schema.
"Mr. X." <no  2008-03-26 16:20:51 
Re: MySql - creating a schema.
Roedy Green <see_websi  2008-03-26 17:05:26 
Re: MySql - creating a schema.
"Mr. X." <no  2008-03-27 16:47:39 
Re: MySql - creating a schema.
Martin Gregorie <marti  2008-03-27 00:58:47 
Re: MySql - creating a schema.
David Harper <devnull@  2008-03-27 07:05:23 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 23:12:48 CST 2008.