473,854 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

good table design...

Hello,

I am designing a table of vehicle types, nothing special, just a list of
unique vehicle types such as truck, lorry, bike, motor bike, plane, tractor
etc etc

For the table design I am proposing a single column table with a field name
called vehicle_type and this will contain the vehicle type.

Sot it will be

vehicle_type
car
bike
tractor
plane
truck
van
blah
blah
blah

Is this ok? Or is there a better way to do it?

Thanks,

td.

Jul 20 '05
36 4664

"toedipper" <se************ ******@hotmail. com> wrote in message
news:30******** *****@uni-berlin.de...
Thanks for your reply.

Totally of topic but what does 'sic' mean? I see this all over the place
both on the web and in print.


It means that what was written was written that way intentionally. For
example, one might say that they when they write, they mispel a lot of words
[sic].

There's a pretty good dictionary at http://m-w.com

Also, if you go to google and search for any word, you'll see that word in
the upper-right quadrant of the screen, next to a link that says
[definition]. Click that link and you'll get the definition.



Jul 20 '05 #11
Joe Celko <jc*******@eart hlink.net> wrote in news:41a65261$0 $14485
$c******@news.n ewsgroups.ws:
why do you kids know all the internet codes and emoticons, but not
Latin? "sic" means "error in the original" [Sic].


Jul 20 '05 #12
>> Could you point the differences, please?

http://www.google.com/groups?selm=e%...phx.gbl&rnum=6


This post uses terms "records" and "fields" as filesystem terms
(portions of bytes stored in files) and as programming language
structures (eg. unions and structs in C/C++).
I use those terms for logical structures desciption, not only
physical representation. For me a struct in C/C++ is a way to
represent/implement logical record, just as it can implement
table row (it may be not a very good idea).

I agree with the reply to that post:
http://www.google.com/groups?hl=pl&l...TNGP11.phx.gbl

It's only a matter of treating terms in logical or physical
manner. I can think of terms "column" and "row" in prysical
manner too (eg. for C/C++/Pascal tables or other more or less
complex programming language structures).

The main idea of relational databases is to have relations
between informations. Storing the informations in one
record of one table is one way to represent the relation,
the other one is to use FOREIGN KEYs. It's not that important
if we call smallest part of information a "field" or "column"
or "cell" (the last one is for me the best one in terms of
"columns" and "rows" and very close to "field" term) as long
as we know what we are describing and are able to understand
what another person is trying to describe.
For me much better term than "table" is "set", cause table
suggests sequence of information.

Hilarion
Jul 20 '05 #13
-P-
"toedipper" <se************ ******@hotmail. com> wrote in message news:30******** *****@uni-berlin.de...
Hello,

I am designing a table of vehicle types, nothing special, just a list of
unique vehicle types such as truck, lorry, bike, motor bike, plane, tractor
etc etc

For the table design I am proposing a single column table with a field name
called vehicle_type and this will contain the vehicle type.

Sot it will be

vehicle_type
car
bike
tractor
plane
truck
van
blah
blah
blah

Is this ok? Or is there a better way to do it?

Thanks,

td.

I've never liked using the "descriptiv e name" of the entity as its primary key. What happens if that descriptive name
changes, and the table is referenced as a foreign key by other tables? You've got a referential integrity problem
(unless you endorse the use of ON UPDATE CASCADE, which I personally abhor.)

This is where I would use a separate identifier as the primary key. Something that will never change (an
autoincremented integer, for example), so that the "descriptio n" column can contain the more volatile descriptive text.

--
Paul Horan
Sr. Architect
VCI Springfield, Mass
www.vcisolutions.com

Jul 20 '05 #14

"-P-" <en**********@h otmail.DOTcom> wrote in message
news:fq******** ************@ad elphia.com...
This is where I would use a separate identifier as the primary key. Something that will never change (an autoincremented integer, for example), so that the "descriptio n" column can contain the more volatile descriptive text.
You realize an autoincremented integer, at least in MS SQL Server is
terrible for this. You can't guarantee that you won't have gaps and you
can't even guarantee that the numbers will remain the same. DBCC CHECKIDENT
can reset things on you, copying them to another DB may completely change
the numbers, etc.

You are right that the descriptions may change. I'd recommend something
like a partial VIN since that's described by an outside authority and pretty
much won't change.

--
Paul Horan
Sr. Architect
VCI Springfield, Mass
www.vcisolutions.com

Jul 20 '05 #15
> You realize an autoincremented integer, at least in MS SQL Server is
terrible for this. You can't guarantee that you won't have gaps


What's with those gaps? I always wonder. Who cares about them? It's not
a row number, but a key, so gaps are OK.

Hilarion
Jul 20 '05 #16
You've failed to make the vital distinction between a *surrogate* key and a
*natural* key. You have no data integrity if your data looks like this:

id vehicle
----------- -----------
1 Car
2 Car
3 Truck

An autoincrementin g surrogate key should never be the only key of a table.

--
David Portas
SQL Server MVP
--
Jul 20 '05 #17
-P-
"Greg D. Moore (Strider)" <mo************ ****@greenms.co m> wrote in message
news:9E******** *********@twist er.nyroc.rr.com ...

"-P-" <en**********@h otmail.DOTcom> wrote in message
news:fq******** ************@ad elphia.com...
This is where I would use a separate identifier as the primary key.

Something that will never change (an
autoincremented integer, for example), so that the "descriptio n" column

can contain the more volatile descriptive text.


You realize an autoincremented integer, at least in MS SQL Server is
terrible for this. You can't guarantee that you won't have gaps and you
can't even guarantee that the numbers will remain the same. DBCC CHECKIDENT
can reset things on you, copying them to another DB may completely change
the numbers, etc.

You are right that the descriptions may change. I'd recommend something
like a partial VIN since that's described by an outside authority and pretty
much won't change.

"Not having gaps" wasn't specified as a requirement... <G> I think gaps in identity columns are perfectly fine -
unless you're exposing the number to the user, as with an invoice number or some other "auditable" entity. In that
case, I wouldn't use IDENTITY.

-P-

Jul 20 '05 #18
-P-
"David Portas" <RE************ *************** *@acm.org> wrote in message news:1P******** ************@gi ganews.com...
You've failed to make the vital distinction between a *surrogate* key and a *natural* key. You have no data integrity
if your data looks like this:

id vehicle
----------- -----------
1 Car
2 Car
3 Truck

An autoincrementin g surrogate key should never be the only key of a table.


Baloney... A simple unique index or constraint on the description would prevent the scenario you just described.

"Never"? I also disagree with that statement. There are perfectly acceptable uses for that design.

-Paul-
Jul 20 '05 #19
> I agree with the reply to that post:
http://www.google.com/groups?hl=pl&l...TNGP11.phx.gbl


I mean I agree to the post pointed by the URL, and which is a replty to the
oryginal post.

Hilarion
Jul 20 '05 #20

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

Similar topics

24
3634
by: matty | last post by:
Go away for a few days and you miss it all... A few opinions... Programming is a craft more than an art (software engineering, not black magic) and as such, is about writing code that works, first and foremost. If it works well, even better. The same goes for ease of maintenance, memory footprint, speed, etc, etc. Most of the time, people are writing code for a use in the *real world*, and not just as an academic exercise. Look at...
52
6458
by: Tony Marston | last post by:
Several months ago I started a thread with the title "What is/is not considered to be good OO programming" which started a long and interesting discussion. I have condensed the arguments into a single article which can be viewed at http://www.tonymarston.net/php-mysql/good-bad-oop.html I fully expect this to be the start of another flame war, so sharpen your knives and get stuck in!
1
4211
by: David Thompson | last post by:
Looking for a book to help me develop a philosophy for building databases (particularly on MySQL). And then taking them from concept to construction. Something like.... Start by asking which queries you will be performing, then define all data needed for each of those queries, then progress to normalize this data, etc. Any Ideas....thanks...
3
2033
by: cassandra.flowers | last post by:
I'm designing a database because I have to do it for the preperation work for my A-Level ICT exam. The database is for a building company. It has to store information on building projects (tblProject) and employees (tblPersonnel) then link them together.
15
2744
by: Hi5 | last post by:
Hi, I am designing a database for a client in which It has a client table including the followings: 1-Table Client 2-Table lookupcategory 3-Table Ctegory
7
1853
by: farseer | last post by:
Here is the scenario: I have an interface which defines get methods for data that will make up a row in a table. However, the source of this data may, over time, switch/change (The company may choose to change data providers). Therefore i thought to myself, a type of Adapter Pattern is best here and so i proceeded with that. here's an example of what i did (note this implementation differs from the text book one due to the way data...
4
3941
by: Nathan Sokalski | last post by:
When editing an ASP Table, Visual Studio does not allow me to edit it in Design View. This makes it harder to add elements, because I must add every element either by using Design View to create the element outside of the table and then using cut & paste in HTML View to move it to the desired location, or by manually typing the code in using HTML View. The first technique sometimes does not automatically update the list of elements...
7
4870
by: david | last post by:
I have asked this question before. But it does not work for me. Given radion buttons in the web form design page. What I did is described as follows. A panel control is dragged into the design form, and a table control is dragged into the panel from tooolbox. Add cells for the table through the properties. Now I cut a radio button, and click the table (note I can not select a cell), then right click Paste. The button is not in expected...
3
1354
by: Chris | last post by:
Hi again, I need another good practise advice. Everybody (100 persons) in our compagny manages one or more projects. Each projects needs two tables: table 'project' (general information), table 'projectdetails' (details of projects) and one or more result tables (one per project) like 'projectresult1', 'projectresult2' etc ... One project needs more or less 300 records with 6 fields (with size: nvarchar(200) average)). Nothing...
0
9903
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11044
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10692
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10767
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7927
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7084
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5952
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4567
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
2
4168
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.