Relational Databases How?

OMG, thank you for creating this. I know some PHP and some mysql, but putting the two together has been a challenge due to constraints in time. This is a BIG stress reliever for me.

I am curious, I'd love to tie my author table to my books table but I have no clue how to do it. I get the idea of tying the tables with a key, but I get real brain farts when it comes to the details.

Is there a help system somewhere or does anyone know of a good relational database hints for idiots website? If there is a way to figure it out from here, that would be great.

Thank you!

Rebecca

 

marbour

Member
Dear Rebecca.

I will try out on this one.

Click on Docs & FAQs above and read on field type of select single. This means that you may only make one selection out of a combo box. These choices can be linked to another table containing an indexed field as well as another containing the description.

Then, on the same page, just lower, it says:
# Primary key field: if a field is a select_single, and the options must be driven from another table (so the field can be considered foreign key), specify here the corresponding primary key
# Primary key table: specify here the table that contains the primary key field
# Linked fields: the fields in the primary key table you want to display. Imagine you have a table albums_tab that contains information about CDs. In this table you have a field ID_author that "links" the table authors_tab. If you want to display, for each record, first_name_author and last_name_author of author_tab, you have to use ID_author as primary key, authors_tab as primary key table, first_name_author~last_name_author as linked fields

So let's make a scenario: in table 1, you have a select_single field named answer_question that has to contain the answer to a question like, for example, the name of the president.

In table 2, you have 2 fields, president_id, and president_name. This table contains all the names of all the presidents.

Go into the interface configurator for table 1, change the field to answer_question, make it a select_single... Then, for Primary key field, you will put president_id... Then in Primary key table, you put the name of table 2... And finally, in Linked fields, you put president_name.

This is the minimum configuration you need to make this work. You could have it sorted, then read on order by and order type...

Save these changes and you should be up and running with your first select_single field.

Let's make another scenario... Same field... but the answer should be Yes or No instead. Don't go through the lenght of creating a table for that... In the interface configurator for the field answer_question in table 1, make it a select_single, in the "Option to include" field, put " Yes~No~" (remove the quotes and don't forget the leading space. In this case, I used the default choice separator (~). Should you require the ~ symbol in the choice you needed to offer, then use # as a separator and you field "Option to include" would now look like " Yes#No#".

Hope it helps.

Best regards.

 
Top