I'm working with MariaDB through PHPMyAdmin and I have a question about how I need to set up my database. For eash person in the table I am currently building I'll also need an array of date values. I don't think there is a way for me to setup a table in this fassion.
-> fName, lName, ID, arrayOfDateValues. I will also not know exactly how many date values may be needed, sometimes an entry may only need 1, other times and entry may have 4+. I'm assuming I'll need to create a sepearte table and just make sure that I create enough rows for all the possible dates I may need. Could someone shed a llittle light on this for me please? Thanks.

Also, does anyone know how to create a key table PHPMyAdmin so I'll be able to link up the date(s) with the correcty entries? Thanks again.

2 Years
Discussion Span
Last Post by diafol

You'll need 2 tables:

users: fName, lName, ID with ID as Primary key
userdates: ID, date where both fields make the primary key

You need to make ID in userdates as a foreign key (constraint)

Use joins to get ALL dates for a user. You could also use GROUP_CONCAT to get something similar to what you want with the one table.

Edited by diafol


The ID's in this case are 8 digit numbers that will not follow any discernible progression. Shouldn't I create another column as primary key and have it set to auto increment? I'm not good with databases so I'm just guessing. Also, how are these things done in PHPMyAdmin? Thanks again.


Pk doen't have to be autoincrement. If you are supplying ID for every user you create and they are unique. Fine.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.