HighDots Forums  

quick question - multiple database tables

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss quick question - multiple database tables in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
artane webforumsuser@macromedia.com
 
Posts: n/a

Default quick question - multiple database tables - 07-13-2003 , 02:38 PM






Hey guys,

I've been having some problems with username authentication and insert record etc and it occured to me that my problem may be in the way my database is constructed.

Presently, I'm using an access database that has one table with multiple columns. Within my site, I have an insert record page with two text fields. These fields corespond with two columns in my database table. The user submits this info and is then fowarded to another page with several other text fields that corespond with the remaining empty columns in the same database table.

Is this bad practice? Should there be seperate tables for each page? What is the rule?

Thanks very much,

artane







Reply With Quote
  #2  
Old   
Ron
 
Posts: n/a

Default Re: quick question - multiple database tables - 07-13-2003 , 03:10 PM






Post the structure of your table like so to the group:

TableName
- FieldName (description if necessary)
- FieldName (...)

Generally speaking, a record/row in a table/view represents an instance of a
entity in your application. You mention user authentication, so User is an
entity (table name = Users)...is the user a customer, an employee an
administrator? Getting a more specific meaning of your entity offers greater
explanation to the purpose of the table (Customers is more meaningful that
User, if the site is commerce related).

With that said, the fields in the table describe characteristics of the
entity, or its associations to other entities in the application.

Imagine this scenario: A Student registers for classes by entering their
firstname, lastname and security credentials (desired username, password).
Upon submittal they are assigned a unique id. A Student can register for one
or more classes by choosing the course number and desired attendance period
(summer, fall, winter, spring).

So, picking out the entities we have Students, Classes and an association
between Students and Classes (a student can register for one or more
classess -- 1 to N relationship - 1 Student, Many Classes).

Students
- StudentID (Autonumber)
- Firstname
- Lastname
- Username
- Userpass

Classes
- ClassID (e.g 'HUM101', 'ECO101')
- ClassName (e.g 'Humanities 101')
- Period (one of fall, summer, winter, spring)

Note that the Student table does not have fields to represent the courses
they are taking. The 1 to N relationship between Students & Classes is
handled by a linking table:

Student2Classes
- StudentID
- ClassID

A student with StudentID 2001 can have many entries in Student2Classes if
that student is taking more than 1 class. A Student with ID 3003 can have no
entries if that student is not taking classes.

Anyways, hope that helps some.

--
Ron



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.