Unix Technical Forum

field features...

This is a discussion on field features... within the MySQL forums, part of the Database Server Software category; --> I have a table A with two fields, length and temperature, eg. Both fields have some charateristics, like: field ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 11:30 AM
Osiris
 
Posts: n/a
Default field features...

I have a table A with two fields, length and temperature, eg.
Both fields have some charateristics, like:

field length to use when printing,
units (meters, degrees)
maximum value
minimum value
default value
etc etc.

How would I describe such a situation in MySQL ?
I was thinking of making another table B of "characterisctics" and then
connecting fields in table A to records in table B.
Can that be done in MySQL ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 11:30 AM
Rik Wasmus
 
Posts: n/a
Default Re: field features...

On Tue, 11 Dec 2007 11:08:00 +0100, Osiris <et57@hotmail.com> wrote:
> I have a table A with two fields, length and temperature, eg.
> Both fields have some charateristics, like:
>
> field length to use when printing,


Nothing to do with MySQL.

> units (meters, degrees)


Again, nothing to do with MySQL, or the value in the columns (just append
it if needed).

> maximum value
> minimum value


Unless you can whitelist all the values (foreign key constraint on another
field/table holding all possible values for the column, you'll have to use
triggers.

> default value


Default is easily given as a field property.

> How would I describe such a situation in MySQL ?
> I was thinking of making another table B of "characterisctics" and then
> connecting fields in table A to records in table B.
> Can that be done in MySQL ?


You can store some information about a field in another table. Most of
what I think you want cannot be done automatically with MySQL though,
you'll have to use the logic either in the script/application using MySQL,
or be prepared to write some very long queries, with dozens of
if-statemenst/joins for each field just to get the right 'representation'.

For more control over what goes into a field/row or gets deleted, you can
use triggers and/or foreign key constraints. There is no such thing for
selects though.
--
Rik Wasmus
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:59 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com