in reply to Question about properly laying out a database
You should have this:my %cars = ( 1001 => { make => "Chevrolet", model => "Camaro", year => 1972, price => 6000, }, ...
Then, your "make" and "model" search functions are doing fast, numerical comparisons, and not string matches. And you're guaranteed to have consistent spelling of Chevrolet! You never have to match /chev(y|rolet)/i!my %cars = ( 1002 => { make_id => 10, model_id => 27, year => 2001, price => 24000, }, ); my %makes = { 1 = "Chevrolet", 10 = "Acura", }; my %models = { 12 = "Camaro", 27 = "RSX", };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Question about properly laying out a database
by perrin (Chancellor) on Dec 12, 2001 at 04:08 UTC | |
by joealba (Hermit) on Dec 12, 2001 at 09:31 UTC | |
by perrin (Chancellor) on Dec 12, 2001 at 12:32 UTC | |
by dws (Chancellor) on Dec 12, 2001 at 12:40 UTC | |
by perrin (Chancellor) on Dec 12, 2001 at 23:13 UTC | |
|
Re(2): Question about properly laying out a database
by dmmiller2k (Chaplain) on Dec 13, 2001 at 01:13 UTC | |
by joealba (Hermit) on Dec 13, 2001 at 02:44 UTC |