close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Parent Child Tables

Thread began 4/21/2010 8:39 pm by lilyvo30405875 | Last modified 4/23/2010 8:22 am by Jason Byrnes | 6568 views | 7 replies |

lilyvo30405875

Parent Child Tables

I know how to create a table in starfield technologies (looks the same as phpmyadmin) but I don't know how to make 2 tables that are parent and child tables. I looked online and haven't found anything. Do you know how to do this? If so that would be great. Everything else is easy I am just not sure how to do this.

Thanks again!

Lily

Sign in to reply to this post

Jason ByrnesWebAssist

A child table uses a foreign key to relate records to the parent table.

for example, lets say you had users and user groups.

To create a one to many relationship of User Groups to Users, the User Groups table would be the parent table, the users table would be the child table.

Both tables will have a primary key column which is an auto number column, the users table will a foreign key column used to relate the user to the user group. In this column, you will store the value from the UserGroups Primary key column for the group the user should belong to


UserGroups:
userGroupID - primary Key
userGroupName - text

userGroupID | userGroupName
--------------+--------------------
1 | Administrator
2 | Power User
3 | User
--------------|---------------------

Users:
userID - Primary Key
userUserGroupID - Foreign key - relates to UserGroups.userGroupID
userName

userID | userUserGroupID | userName
--------+--------------------+------------
1 | 1 | Jason
2 | 1 | John
3 | 3 | Adam
4 | 2 | George
5 | 3 | Tom


In the sample data above our users are members of the following user groups:
Jason - Administrator
John - Administrator
Adam - User
George - Power User
Tom - User

Sign in to reply to this post

lilyvo30405875

2 More specific questions

1. I don't need 2 tables, all of my information is one and I don't see a purpose in creating 2 (with the example above that makes sense but I have everything categorized in my table multiple ways and don't see the importance of creating multiple tables) My question is is it necessary to create multiple tables and if so would I just do...

Parent Table
Parent ID
Company Name

Child Table
Company ID
Parent ID (that I have to hand write in for each one)
Company Name
Phone Number
Location
Business Type
...

2. My second question is for the child table do I have to hand write each number in and is this just a field I set up in mysql?

Thanks again

Sign in to reply to this post

Jason ByrnesWebAssist

the purpose of using a parent table is for data normalization. It is to cut down on the amount of redundant data in your database, and to minimize storage requirements.

Storing a number in multiple records takes less space than storing a string in multiple records.

Do you _need_ to use a parent table? No.

Perhaps the better place to start here is to find out what exactly are you trying to accomplish with dynamic drop downs?

Sign in to reply to this post

lilyvo30405875

Re:

I am trying to query the database

For example I would like to search for a company by different columns like location, or cost to invest, or type of business, etc. I have multiple variables for each company and would like the ability to just click a button and have the users be able to get results based on the specific variable that they are interested in.

If this is possible how do I go about doing this without having multiple tables. If not how do I set up a refund?

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

it is possible to do this using the DataAssist extension.

Using DataAssist you can create a Search and results page that allow you to search your database table on any of the fields.



Please contact our sales department if you want to arrange for a refund of Dynamic Dropdowns

Sign in to reply to this post

lilyvo30405875

Re;

I would like to use this software and not have to get a refund I just don't know how to do what your saying. You say that I don't have to have multiple tables how do I go about doing that. Since the instructions are for multiple tables I don't know what I should or shouldn't do.

I appreciate your time but I was under the impression that this wasn't very complicated. I am obviously frustrated but hope to make this product work with some guidance. I also hope to use other products by this company but I wont be able to do that if this isn't working.

Thanks for guiding me in the right direction.

Lily

Sign in to reply to this post

Jason ByrnesWebAssist

Dynamic Dropdowns is not the extension to use for creating a search and results page to query the database.

To create a search page that will query the database, and display the results of that search, you need to use DataAssist


with data assist, you can run the data assist wizard to create the search and results page based on your table.


Dynamic Dropdowns is used for creating a list that filter related data.
A good example is a car site.
in the parent list, you would select the make of car: Ford, Toyota, Subaru, Nissan etc.. When you make a selection in the parent list, it will populate the child list models for the selected make. Choose Subaru and the child list is populated with Forester, Outback, Tribecca. Choose nisan, and the child list is populated with Sentra, Maxima, Quest etc.. This is not the correct tool to be using.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...