From: Champ on
On Wed, 10 Feb 2010 07:30:51 +0000, Pip Luscher
<pluscher(a)live.invalid.co.uk> wrote:

>At work, as a result of merging two vastly differing production
>systems, we've got a requirement for production line servers to keep
>track of a second serial number on some but not all products:
>effectively a software serial number as well as the box's hardware
>serial number. This has to be linked to the box's hardware number
>(which is on a label on the box) so that it can be identified under,
>say, warranty conditions.
>
>As I'm no database guru, what's /technically/ the best way to do this:
>add a column to the existing table that already stores the hardware
>serial number, or add a whole new table that links the two? Or is it
>simply a matter of horses for courses? I may simply opt for whatever's
>easiest to implement but I would like to have an idea of what the best
>practrce is.

Is there a one to one relationship between the hardware serial number
and the software serial number? It sounds like there is. If so, then
I'd agree with Darsy and say that you should just add a column.
--
Champ
We declare that the splendour of the world has been enriched by a new beauty: the beauty of speed.
ZX10R | Hayabusa | GPz750turbo
neal at champ dot org dot uk
From: Pete Fisher on
In communiqu� <46n4n51bv1mmdsi80vldus32nlkm163jvs(a)4ax.com>, Pip Luscher
<pluscher(a)live.invalid.co.uk> cast forth these pearls of wisdom
>At work, as a result of merging two vastly differing production
>systems, we've got a requirement for production line servers to keep
>track of a second serial number on some but not all products:
>effectively a software serial number as well as the box's hardware
>serial number. This has to be linked to the box's hardware number
>(which is on a label on the box) so that it can be identified under,
>say, warranty conditions.
>
>As I'm no database guru, what's /technically/ the best way to do this:
>add a column to the existing table that already stores the hardware
>serial number, or add a whole new table that links the two? Or is it
>simply a matter of horses for courses? I may simply opt for whatever's
>easiest to implement but I would like to have an idea of what the best
>practrce is.

As others have said, if it is effectively a one to one relationship add
a new column (after backing up naturally). Obviously, if you then later
find that other packages with serial numbers that need to be linked to
the same box, then will wish you had created a new table, so this could
be the future-proofed approach.

Naturally, the column add is going to be impossible to do if you can't
exclusively lock the table, or prepare a new table and swap it in during
a brief system downtime window. In that case the new table strategy has
some merit, though it's inelegant and inefficient IMO.


--
+-------------------------------------------------------------------+
| Pete Fisher at Home: Peter(a)ps-fisher.demon.co.uk |
| Voxan Roadster Yamaha WR250Z/Supermoto "Old Gimmer's Hillclimber" |
| Gilera GFR * 2 Moto Morini 2C/375 Morini 350 "Forgotten Error" |
+-------------------------------------------------------------------+
From: darsy on
On Feb 10, 9:14 am, Pete Fisher <Pe...(a)ps-fisher.demon.co.uk> wrote:

> Naturally, the column add is going to be impossible to do if you can't
> exclusively lock the table, or prepare a new table and swap it in during
> a brief system downtime window.

I would massively recommend preparing a new table and swapping the
datasource - making live modifications to production DBs is a fool's
game.

--
d.
From: 72degrees on
On 10 Feb, 09:20, darsy <dar...(a)gmail.com> wrote:
> On Feb 10, 9:14 am, Pete Fisher <Pe...(a)ps-fisher.demon.co.uk> wrote:
>
> > Naturally, the column add is going to be impossible to do if you can't
> > exclusively lock the table, or prepare a new table and swap it in during
> > a brief system downtime window.
>
> I would massively recommend preparing a new table and swapping the
> datasource - making live modifications to production DBs is a fool's
> game.
>

Agreed. I'd even do that if just playing about with a mySQL database
on one of my web domains.


From: R C Nesbit on
Pip Luscher spoke:
> At work, as a result of merging two vastly differing production
> systems, we've got a requirement for production line servers to keep
> track of a second serial number on some but not all products:
> effectively a software serial number as well as the box's hardware
> serial number. This has to be linked to the box's hardware number
> (which is on a label on the box) so that it can be identified under,
> say, warranty conditions.

Having read the thread, I can see no really definitive recommendation
so far, but FWIW:

From your scenario above you do not have a strict 1 to 1 relationship.
Adding a column might be a sensible solution, but you would have to be
careful with default/null values, or it could impact on existing
queries.

Also possible future scenario could be more than one software serial no
per hardware box?
Making it a no-brainer, add a table. - but be careful with joins in
subsequent queries

--
Rob_P
UKRM(at)indqualtec.co.uk
uppercase(d) BBIWYMC#1 BOG#11? MRO#31 IBCDBBB#1(kotl)
FJ1200, CCM130 Benelli Cabriolet (gone)
Looks like Rab C Nesbit.