Jump to content

jc2006

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jc2006's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi I have the following situation:            user             |m             |             |m car ----------wax       m          m  The user has a many to many relationship to the "many to many relationship" of car and wax.  I have tables of car, wax and user.  I have a car_to_wax table that shows which waxes can be used for a given car.  Is it possible to create another table, a user_car_wax table, that shows which waxes the user has actually used for certain cars?  Wouldn't this entail a table with three primary keys?  Is there another solution?  Thanks a bunch in advance.
  2. Sorry, I guess I wasn't specific enough.  Here's an example: Table 1 lists restaurants: A, B Table 2 list customers: M, N Table 3 lists food: X, Y Table 4: is the many to many relationship between restaurants and customers. I'll call it restaurants_to_customers. A --- M A --- N B --- N Table 5: is the many to many relationship between customer and food. customers_to_food M -- X N -- Y Table 6: is the many to many relationship between restaurant and food. restaurant to food. A--X A--Y B--Y A given customer "N" can eat at a given restaurant "A."  And, customer "N" may have eaten a meal "Y" before.  But because of tables above,  is there a way to determine if he ate meal "Y" actually AT restaurant "A" or at a different restaurant "B"? Put another way, if I listed all the places customer "N" ate at it would include restaurant "A" and "B."  And since both these places serve meal "Y" is there any way to know if the  customer actually ate the meal "Y" at these restaurant A or B?  Wouldn't it be easiest to create a many_to_many relationship between restaurants, customers, and meals?  I don't think this is possible though.  Or is there a better solution? I apologize in advance if my explanation is convoluted and makes little sense. Thanks
  3. Hi I have a problem with table design. Is it possible to have many to many relationships between 3 tables? I have a unique situation as follows: table 1 ---  many to many table  --- table 2                         |                         |                       table 3 Is such a scenario possible? Thanks J
  4. Hi I am using Smarty to create a template.  In the template, there is a form.  I perform various validations using Javascript, but there are certain validations which must be performed on the server-side.  I currently have user.php and  user.tpl pages along with a userProcess.php form which simply handles the server-side validation.  My question is, what is the best way to pass data back from the userProcess.php form back to the template, user.tpl?  For example, if I wanted to validate that if a new user signing into my website has previously registered, how can I send the results back to the user.tpl page?...Is the best method to pass values through the url?  Also, if I do this, then won't it be difficult to preserve the values that were inputted into the form so that the user does not have to re-enter them? Thanks in advance, J
  5. Hi In the example I would be hesitant to make a single table with flags because employee.job_title and customer.cust_credit are unique attributes to each employee and customer tables. Could you please elaborate on your comment about fk constraints?  It's actually a book example, and in practice, I would not actually use foreign keys because they are not allowed with MyISAM tables...but I know the notation would be similar. Thanks.
  6. First, I wanted to thank you for being so helpful. I really appreciate your efforts - thanks! I have an example here from a book I have called "Database Modeling and Design" In this example "Individual" is a parent to "Employee" and "Customer" So: create table individual ( indiv_id char(10), indiv_name char(20) indiv_addr(20) primary key(indiv_id)) create table employee( emp_id char(10), job_title char(15), primary key(emp_id), foreign key (emp_id) references individual on delete cascade on update cascade); create table customer( cust_no char(10), cust_credit char(12), primary key(cust_no), foreign key (cust_no) references individual on delete cascade on update cascade); In my example I have two users who log onto the site... "individual" is a generalization of "employee" and "customer."  If a user who logs on w/ a given session were to update attributes in both "individual" and "employee", for example, both "individual" and "employee" tables would have to be locked.  This means in another user session, that "customer" table would momentarily be locked from the "individual" parent table.  Wouldn't this slow things down for a site w/ many users? In these instances, wouldn't it be better to have two tables "employee" and "customer?"  Both of these tables would have their aforementioned attributes and keys plus each of them would have the parent's attritbutes so: create table employee ( emp_id char(10) emp_name char(20) emp_addr char(20) job_title char(15), primary key(emp_id)); create table customer ( cust_no char(10), cust_name char(20), cust_addr char(20), cust_credit char(12), primary key (cust_no));  Is this a valid argument for repeating attributes in tables as opposed to generalization? Thanks again.
  7. Hi MyISAM involves table locking as opposed to row locking for InnoDB. I was speaking of an instance such as this: TABLE books --- Parent table     bookID     bookName     bookDescription Table automotiveBooks --- Child Table     typeOfCar     carCompanyName     dealershipsNamed Table childrenBooks  --- ChildTable     ageGroup     cartoonCharactersUsed If an update was needed to be made to an automotive book by a user 1 in a session (where a read is first done to get the records and then an update is performed) to change the bookName, bookDescription, typeOfCar, carCompanyName, and dealershipsNamed, then both the parent table "books" and the child table "auotomotiveBooks" would have to be locked.  Because the parent table would be locked, a user 2 in another session would not be able to perform the same read/update operation for the childrenBooks table and the books parent table until the parent table is unlocked by the user 1 in the prior mentioned session.  This would be in lieu of having all the data in one table.  In this situation, only one table would be locked: Table automotiveBooks   bookID   bookName   bookDescription   typeOfCar   carCompanyName   dealershipsNamed I am new to database design so I hope that I am making sense... Thanks for helping.
  8. Thanks for the response.  What about the locking of parent and children tables?  Because parent AND children tables can be locked during certain concurrency situations, wouldn't it be more efficient to avoid hierarchies (so that only one table will be locked)?  Thanks
  9. Hi, I am new to MySQL.  I was wondering if using generalization/specialization hierachies are recommended for MyISAM tables in MySQL.  I understand that there is no recursion in MySQL which would be nice to have for parent/child relationships.  Also, since I am using MyISAM tables, concurrency would at times involve locking a parent and some of its children (locking many tables vs. locking a single table when hierarchies are not used). Would it be better to not use hierarchies? Thanks.  Any help is very much appreciated. 
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.