473,568 Members | 2,882 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple DB Design Questions

Hi folks...

As part of an assignment, I have to design and implement a fairly
small MYSQL 4.0.17 database for a fictitious travel agency. This
database will store data from customers submitting it through
application forms. I will test my implementation on an old Linux box
(RedHat 6.x with PHP 4.0.5 and MySQL 4.0.17, running on an AMD
processor and 64MB of memory).

Each APPLICATION form will have 4 parts:

- PASSENGER details: name, surname, etc.
- CONTACT details: phone number(s), postal and e-mail addresses
- INFORMATION on the trip: departure and return dates, etc.
- CONTROL data: agency-specific (e.g., booking operator)

If I put all the above information into 1 table, APPLICATION, it will
have around 30 fields and a record size in the order of 1 KB/customer
(no more than 10,000 records expected).

If I put the information into 4 tables (PASSENGER, CONTACT,
INFORMATION, CONTROL), then none will have more than 10 fields/record,
but I need to associate them with, say, the PASSENGER key. But, if I
use auto increment, I will have to rely on the mysql_insert_id ()
function, which I am not happy about, since multiple simultaneous
accesses of the database is in the specs of the assignment and this
function examines the last INSERT. (Table locks and transaction
processing might help here.)

So, my question is, which design path to follow: 1 table, or 4 tables
and, if the latter, how do I go about reliably retrieving the
auto_increment key?

Cheers,

Dimitris
Jul 19 '05 #1
30 2086
why not try both ?

try 1 table first, then try 4 tables ....

the problem with 1 table is that you will have repeating fields,
(something that DB purists will have a problem with)
this will waste some disk space, but you will not need to do any joins
to retrieve data, so it should be faster to run and faster to create.

the problem with 4 tables is that your design becomes more
complicated,
meaning maintenance is more complex, perhaps you will have 4 screens
instead of 1.

Regards
Michael Newport
Jul 19 '05 #2
why not try both ?

try 1 table first, then try 4 tables ....

the problem with 1 table is that you will have repeating fields,
(something that DB purists will have a problem with)
this will waste some disk space, but you will not need to do any joins
to retrieve data, so it should be faster to run and faster to create.

the problem with 4 tables is that your design becomes more
complicated,
meaning maintenance is more complex, perhaps you will have 4 screens
instead of 1.

Regards
Michael Newport
Jul 19 '05 #3
why not try both ?

try 1 table first, then try 4 tables ....

the problem with 1 table is that you will have repeating fields,
(something that DB purists will have a problem with)
this will waste some disk space, but you will not need to do any joins
to retrieve data, so it should be faster to run and faster to create.

the problem with 4 tables is that your design becomes more
complicated,
meaning maintenance is more complex, perhaps you will have 4 screens
instead of 1.

Regards
Michael Newport
Jul 19 '05 #4
On 9 Feb 2004 00:17:34 -0800, in mailing.databas e.mysql
mi************@ yahoo.com (michael newport) wrote:
| why not try both ?
|
| try 1 table first, then try 4 tables ....
|
| the problem with 1 table is that you will have repeating fields,
| (something that DB purists will have a problem with)
Not really, some tables/databases are best left un-normalised.
The main problem with only using a single table is the accuracy of the
repeating data. For example, in the departure section of data some
people may put Los Angeles and other people might enter LAX or L.A. or
LA. Imagine doing a query to find the number of departures from any
given location.
| this will waste some disk space, but you will not need to do any joins
| to retrieve data, so it should be faster to run and faster to create.
This might be true but retrieving information/stats could be a real
nightmare.
| the problem with 4 tables is that your design becomes more
| complicated,
| meaning maintenance is more complex, perhaps you will have 4 screens
| instead of 1.


So? :-)
What about all the reports/stats information pages? :-)
---------------------------------------------------------------
jn****@yourpant sbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 19 '05 #5
On 9 Feb 2004 00:17:34 -0800, in mailing.databas e.mysql
mi************@ yahoo.com (michael newport) wrote:
| why not try both ?
|
| try 1 table first, then try 4 tables ....
|
| the problem with 1 table is that you will have repeating fields,
| (something that DB purists will have a problem with)
Not really, some tables/databases are best left un-normalised.
The main problem with only using a single table is the accuracy of the
repeating data. For example, in the departure section of data some
people may put Los Angeles and other people might enter LAX or L.A. or
LA. Imagine doing a query to find the number of departures from any
given location.
| this will waste some disk space, but you will not need to do any joins
| to retrieve data, so it should be faster to run and faster to create.
This might be true but retrieving information/stats could be a real
nightmare.
| the problem with 4 tables is that your design becomes more
| complicated,
| meaning maintenance is more complex, perhaps you will have 4 screens
| instead of 1.


So? :-)
What about all the reports/stats information pages? :-)
---------------------------------------------------------------
jn****@yourpant sbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 19 '05 #6
On 9 Feb 2004 00:17:34 -0800, in mailing.databas e.mysql
mi************@ yahoo.com (michael newport) wrote:
| why not try both ?
|
| try 1 table first, then try 4 tables ....
|
| the problem with 1 table is that you will have repeating fields,
| (something that DB purists will have a problem with)
Not really, some tables/databases are best left un-normalised.
The main problem with only using a single table is the accuracy of the
repeating data. For example, in the departure section of data some
people may put Los Angeles and other people might enter LAX or L.A. or
LA. Imagine doing a query to find the number of departures from any
given location.
| this will waste some disk space, but you will not need to do any joins
| to retrieve data, so it should be faster to run and faster to create.
This might be true but retrieving information/stats could be a real
nightmare.
| the problem with 4 tables is that your design becomes more
| complicated,
| meaning maintenance is more complex, perhaps you will have 4 screens
| instead of 1.


So? :-)
What about all the reports/stats information pages? :-)
---------------------------------------------------------------
jn****@yourpant sbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 19 '05 #7

"Dimitris" <dt*****@yahoo. com> wrote in message
news:39******** *************** ***@posting.goo gle.com...
Hi folks...

As part of an assignment, I have to design and implement a fairly
small MYSQL 4.0.17 database for a fictitious travel agency. This
database will store data from customers submitting it through
application forms. I will test my implementation on an old Linux box
(RedHat 6.x with PHP 4.0.5 and MySQL 4.0.17, running on an AMD
processor and 64MB of memory).

Each APPLICATION form will have 4 parts:

- PASSENGER details: name, surname, etc.
- CONTACT details: phone number(s), postal and e-mail addresses
- INFORMATION on the trip: departure and return dates, etc.
- CONTROL data: agency-specific (e.g., booking operator)

So, my question is, which design path to follow: 1 table, or 4 tables
and, if the latter, how do I go about reliably retrieving the
auto_increment key?

You need to look at what the primary key is going to be. Is this a
passenger-based system or a booking-based system. The reason I mention this
is because you could get away with one table, if you are booking-based. That
is, each row is a different booking item. IMO, it is still bad design to do
one table, because of the lack of expandibility. My opinion is to create
three tables...passen ger, trip, control. Joining them is really easy. For
example, for a booking-based system, I'd go with...

PASSENGER
-rowid
-name
-...

TRIP
-rowid
-passengerid
-controlid
-departer...

CONTROL
-rowid
-operatorname
You certianly wouldn't have any issues with record collision in this
scenereo. I use this type of structure for many of my db apps, and I have
thousands of transactions/minute and >15M rows in many systems.
Jul 19 '05 #8

"Dimitris" <dt*****@yahoo. com> wrote in message
news:39******** *************** ***@posting.goo gle.com...
Hi folks...

As part of an assignment, I have to design and implement a fairly
small MYSQL 4.0.17 database for a fictitious travel agency. This
database will store data from customers submitting it through
application forms. I will test my implementation on an old Linux box
(RedHat 6.x with PHP 4.0.5 and MySQL 4.0.17, running on an AMD
processor and 64MB of memory).

Each APPLICATION form will have 4 parts:

- PASSENGER details: name, surname, etc.
- CONTACT details: phone number(s), postal and e-mail addresses
- INFORMATION on the trip: departure and return dates, etc.
- CONTROL data: agency-specific (e.g., booking operator)

So, my question is, which design path to follow: 1 table, or 4 tables
and, if the latter, how do I go about reliably retrieving the
auto_increment key?

You need to look at what the primary key is going to be. Is this a
passenger-based system or a booking-based system. The reason I mention this
is because you could get away with one table, if you are booking-based. That
is, each row is a different booking item. IMO, it is still bad design to do
one table, because of the lack of expandibility. My opinion is to create
three tables...passen ger, trip, control. Joining them is really easy. For
example, for a booking-based system, I'd go with...

PASSENGER
-rowid
-name
-...

TRIP
-rowid
-passengerid
-controlid
-departer...

CONTROL
-rowid
-operatorname
You certianly wouldn't have any issues with record collision in this
scenereo. I use this type of structure for many of my db apps, and I have
thousands of transactions/minute and >15M rows in many systems.
Jul 19 '05 #9

"Dimitris" <dt*****@yahoo. com> wrote in message
news:39******** *************** ***@posting.goo gle.com...
Hi folks...

As part of an assignment, I have to design and implement a fairly
small MYSQL 4.0.17 database for a fictitious travel agency. This
database will store data from customers submitting it through
application forms. I will test my implementation on an old Linux box
(RedHat 6.x with PHP 4.0.5 and MySQL 4.0.17, running on an AMD
processor and 64MB of memory).

Each APPLICATION form will have 4 parts:

- PASSENGER details: name, surname, etc.
- CONTACT details: phone number(s), postal and e-mail addresses
- INFORMATION on the trip: departure and return dates, etc.
- CONTROL data: agency-specific (e.g., booking operator)

So, my question is, which design path to follow: 1 table, or 4 tables
and, if the latter, how do I go about reliably retrieving the
auto_increment key?

You need to look at what the primary key is going to be. Is this a
passenger-based system or a booking-based system. The reason I mention this
is because you could get away with one table, if you are booking-based. That
is, each row is a different booking item. IMO, it is still bad design to do
one table, because of the lack of expandibility. My opinion is to create
three tables...passen ger, trip, control. Joining them is really easy. For
example, for a booking-based system, I'd go with...

PASSENGER
-rowid
-name
-...

TRIP
-rowid
-passengerid
-controlid
-departer...

CONTROL
-rowid
-operatorname
You certianly wouldn't have any issues with record collision in this
scenereo. I use this type of structure for many of my db apps, and I have
thousands of transactions/minute and >15M rows in many systems.
Jul 19 '05 #10

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

Similar topics

3
3669
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example program #include <list>
6
2441
by: Jacek Dziedzic | last post by:
Hello! First of all please forgive me for not posting a compilable snippet, but rather a simplified piece of code with the unimportant details left out. Let's say I have two classes 'box_shape' and 'cylinder_shape' that derive from a common base class 'shape', more or less like this: namespace Shapes {
9
1380
by: mkdunaway3 | last post by:
I'm just starting out here and I keep running into a basic problem. I build a set of tables: First Names, Last Names, Member Status. I bring these together in a table, Persons' Name & Status, where each person gets an unique ID and the other info is brought into the table by lookup. So far, everything works well. But then, I try to...
3
990
by: shapper | last post by:
Hello, I work mostly in web design and usually I create an administration area. To access administration my clients usually visit a link on their browsers. I would like to create a windows installer which does the following: 1. Opens a directory and copies several files from the CD to the computer. 2. Places icons on the desktop and...
12
2726
by: Michael S | last post by:
Why do people spend so much time writing complex generic types? for fun? to learn? for use? I think of generics like I do about operator overloading. Great to have as a language-feature, as it defines the language more completely. Great to use.
4
2193
by: Jim | last post by:
I saw a simple web page. It had a frameset with 2 frames. The left frame was a navigtion frame, with links to interesting websites and a place to place a username (guess some of the websites were kinda personalized). The right frame contained the website of the link clicked in the navigation frame. Wanting to learn ASP.Net 2.0, I thought...
13
2023
by: aum | last post by:
Hi, I'm a Python programmer, just starting to get into javascript. On reading some of the js guides, and not liking any of the OO usage patterns I saw, I've cooked up something which python folks might find to taste. Here's the code - first the 'engine', then some code demonstrating the usage patterns. For me (and maybe for some of...
17
5791
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /* Simple Thread Object ______________________________________________________________*/ #include <pthread.h> extern "C" void* thread_entry(void*);
4
1574
by: maheshgupta0248 | last post by:
Hi all, Im a newbie in php, started learning php on my own. I want to create small website using php, that contains links for two simple webpages > C questions > C++ questions C questions page, contains a sequence of questions. Each question is a link to another page which details the answers of the specific question, any user can be...
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8117
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6275
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2101
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
932
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.