473,386 Members | 1,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Database structure help

OK, I'm new at all of this and have decided to take on a project to
learn. We have a fishing club that has 23 members. Each weak we go
fishing in various places for 4 hours. Not together, usually 2 to a
boat and it's your choice where to go.
I want to build a database / website that the individual fishermen can
go to and log there success. The fishermen can enter the fish type,
size, weight, date caught. I only want them to add, edit, and delete
their own information they can't mess with the data of others. On the
web page I want to display the member name and number of fish caught
under its respective date. Then you can click on the number and it will
display all of the entries for that member that day. Or you can click
on the date and it will display all the data for that day.
How would you go about building the database? Should I have just one
table for all or a table for each member?
Thanks, I just don't want to jump into this and then find out I should
have gone the other way.

Sep 1 '06 #1
3 1413
Marty wrote:
OK, I'm new at all of this and have decided to take on a project to
learn. We have a fishing club that has 23 members. Each weak we go
fishing in various places for 4 hours. Not together, usually 2 to a
boat and it's your choice where to go.
I want to build a database / website that the individual fishermen can
go to and log there success. The fishermen can enter the fish type,
size, weight, date caught. I only want them to add, edit, and delete
their own information they can't mess with the data of others. On the
web page I want to display the member name and number of fish caught
under its respective date. Then you can click on the number and it will
display all of the entries for that member that day. Or you can click
on the date and it will display all the data for that day.
How would you go about building the database? Should I have just one
table for all or a table for each member?
Thanks, I just don't want to jump into this and then find out I should
have gone the other way.
I would have three tables:

- One for users (So you can know who is updating the table via login)
- One for fish types
- One for a Fish_Outing table that combines the foreign keys for user
and fish types and any detail information for any fish caught for a
particular outing.

You will need the use to login to your app. This way you can allow the
user to modify their own data. The following may get you started. I
assume you would do it in a MySQL Database.

User table would at least have the following rows:

DROP TABLE IF EXISTS `Users`;
CREATE TABLE IF NOT EXISTS `Users`
(
`id` int(11) NOT NULL auto_increment,
`login_account_name` varchar(25) NOT NULL,
`login_password` varchar(25) NOT NULL,
`last_name` varchar(25) NOT NULL,
`first_name` varchar(25) NOT NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `account_name` (`login_account_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=54 ;
Fish table to normalize what fish types can be used. It would at least
have the following rows:

DROP TABLE IF EXISTS `Fish`;
CREATE TABLE IF NOT EXISTS `Fish`
(
`id` int(11) NOT NULL auto_increment,
`TypeOfFish` varchar(100) NOT NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `TypeOfFish` (`TypeOfFish`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=54 ;
FishOuting table would at least have the following rows per fish caught:

DROP TABLE IF EXISTS `FishOuting`;
CREATE TABLE IF NOT EXISTS `FishOuting`
(
`id` int(11) NOT NULL auto_increment,
`user_fk` int(11) NOT NULL,
`fish_fk` int(11) NOT NULL,
`size` int(11) NOT NULL,
`weight` int(11) NOT NULL,
`date_caught`Date NOT NULL,
`time_caught`Time NOT NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `TypeOfFish` (`user_fk`,`fish_fk`,`date_caught`,`time_caught`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=54 ;

--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Sep 1 '06 #2
All I can say is "Wow thanks!"

IchBin wrote:
Marty wrote:
OK, I'm new at all of this and have decided to take on a project to
learn. We have a fishing club that has 23 members. Each weak we go
fishing in various places for 4 hours. Not together, usually 2 to a
boat and it's your choice where to go.
I want to build a database / website that the individual fishermen can
go to and log there success. The fishermen can enter the fish type,
size, weight, date caught. I only want them to add, edit, and delete
their own information they can't mess with the data of others. On the
web page I want to display the member name and number of fish caught
under its respective date. Then you can click on the number and it will
display all of the entries for that member that day. Or you can click
on the date and it will display all the data for that day.
How would you go about building the database? Should I have just one
table for all or a table for each member?
Thanks, I just don't want to jump into this and then find out I should
have gone the other way.
I would have three tables:

- One for users (So you can know who is updating the table via login)
- One for fish types
- One for a Fish_Outing table that combines the foreign keys for user
and fish types and any detail information for any fish caught for a
particular outing.

You will need the use to login to your app. This way you can allow the
user to modify their own data. The following may get you started. I
assume you would do it in a MySQL Database.

User table would at least have the following rows:

DROP TABLE IF EXISTS `Users`;
CREATE TABLE IF NOT EXISTS `Users`
(
`id` int(11) NOT NULL auto_increment,
`login_account_name` varchar(25) NOT NULL,
`login_password` varchar(25) NOT NULL,
`last_name` varchar(25) NOT NULL,
`first_name` varchar(25) NOT NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `account_name` (`login_account_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=54 ;
Fish table to normalize what fish types can be used. It would at least
have the following rows:

DROP TABLE IF EXISTS `Fish`;
CREATE TABLE IF NOT EXISTS `Fish`
(
`id` int(11) NOT NULL auto_increment,
`TypeOfFish` varchar(100) NOT NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `TypeOfFish` (`TypeOfFish`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=54 ;
FishOuting table would at least have the following rows per fish caught:

DROP TABLE IF EXISTS `FishOuting`;
CREATE TABLE IF NOT EXISTS `FishOuting`
(
`id` int(11) NOT NULL auto_increment,
`user_fk` int(11) NOT NULL,
`fish_fk` int(11) NOT NULL,
`size` int(11) NOT NULL,
`weight` int(11) NOT NULL,
`date_caught`Date NOT NULL,
`time_caught`Time NOT NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `TypeOfFish` (`user_fk`,`fish_fk`,`date_caught`,`time_caught`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=54 ;

--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Sep 1 '06 #3
Marty wrote:
All I can say is "Wow thanks!"

IchBin wrote:
>Marty wrote:
>>OK, I'm new at all of this and have decided to take on a project to
learn. We have a fishing club that has 23 members. Each weak we go
fishing in various places for 4 hours. Not together, usually 2 to a
boat and it's your choice where to go.
I want to build a database / website that the individual fishermen can
go to and log there success. The fishermen can enter the fish type,
size, weight, date caught. I only want them to add, edit, and delete
their own information they can't mess with the data of others. On the
web page I want to display the member name and number of fish caught
under its respective date. Then you can click on the number and it will
display all of the entries for that member that day. Or you can click
on the date and it will display all the data for that day.
How would you go about building the database? Should I have just one
table for all or a table for each member?
Thanks, I just don't want to jump into this and then find out I should
have gone the other way.
I would have three tables:
[snip SQL]

For your selects you will want to look at the SQL syntax for 'GROUP BY'
clause. I will let you have some fun and look up that info. You will
need a dropdown <Selectfor the type of fish for a user to select from
when they are inserting their data. There are more details but I will
let you have the 'joy of discovery'.

--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Sep 1 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

346
by: rkusenet | last post by:
http://biz.yahoo.com/rc/040526/tech_database_marketshare_1.html Interesting to see that database sales for windows is more than Unix.
0
by: Pato Secruza | last post by:
Hi everyone! I have a really frustrating error and need help. I’m trying to do a function that gets the properties and names of the fields in a MS Access database using ASP. I haven’t...
5
by: William Wisnieski | last post by:
Hello Everyone, I'm really stuck on how to design this application, so I thought I'd see if anyone had any general ideas on how to proceed. I'd say I'm an intermediate level Access developer. ...
8
by: David | last post by:
Hi, Could someone please xplain how to add a field to an existing SQL table in VB.Net I have added the field in the Server Explorer and it shows up when I reload the program but I cannot...
29
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
2
by: aoao | last post by:
I need to make a new database at the beginning of every year but have forgotten how to do this quickly and efficiently. I have a database with about 10 tables, 10 forms related to the 10 tables...
1
by: Eric Sadoyama | last post by:
I have a database documentation question, but I am not even sure how to phrase it properly so I don't know where to start looking for answers. We are developing a database that is based on...
1
by: FlyingBuckner | last post by:
All right be kind, this is my first question on a forum. I need help on selecting the right software to purchase. I have a database set up using Access, 6 users. It is split into Tables and...
9
by: Peter Duniho | last post by:
Is there a straightfoward API in .NET that allows for inspection of a database? That is, to look at the structure of the database, without knowing anything in advance about it? For example,...
5
rahulephp
by: rahulephp | last post by:
Hi there, can you please help me? i have data in array and i want to insert it in a single table. structure of table and array to be store is shown below: Please let me know how to store...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.