Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: newbie question

Re: newbie question

From: H. John C. Hopkins <john_nospam_at_hpe.ufl.edu>
Date: 1997/12/18
Message-ID: <67bvba$533@no-names.nerdc.ufl.edu>#1/1

Well, that depends...

I'll assume PRICE is variable and not dependent on BRAND, MODEL, or YEAR. I'll also assume you want some "lookup" tables to build an interface. Moreover, I'll assume that you want to use MODEL, BRAND, and CONDITION CODES as foreign keys in a CATALOG table, which you can then relate back to the lookup tables for reports.

If flexibility is not an issue you're just going to be pushing into your CATALOG table a bunch of existing data that will never change, and your list of MODELS and BRANDS and CONDITIONS will never change, then just have one table listing MODEL, BRAND, CONDITION, YEAR, and PRICE and be done with it. Your users will pick from fixed lists of values for their queries and that will be that. Building a flexible, relational database requires only a little extra work (for this simple example anyway) and has the obvious benefit of... well... flexibility.

You need a table called BRANDS that lists all the brands (with fields like BRAND_CODE, BRAND_DESC). You need a table called MODELS that contains the fields MODEL_CODE, MODEL_DESC, BRAND_CODE. This will be related to your BRANDS table by BRAND_CODE. Then you'll want a table called CONDITION that lists all possible conditions, with fields like CONDITION_CODE and CONDITION_DESC.

Now, build your CATALOG table (of products, cars, whatever), with fields for MODEL_CODE, BRAND_CODE, CONDITION_CODE, YEAR, and PRICE. Now enter your data, using your MODELS, CONDITION, and BRANDS tables for lists of values for their respective fields in your CATALOG table. When your users go to query your CATALOG table, you can give them search options from your "lookup" tables.

Again, if your data will NEVER change, go with one big ol' table and forget about using related lookup tables.

Meanwhile, I strongly suggest you to read up on basic database design. Given the nature of your question, I have to wonder what those Oracle courses were about...

-JCH Patrick Hahn wrote in message ...
>I have just taken all of the training courses of Oracle and now I am
>expected to make a database and have it run on the web. Sounds like a
>rough task. Well I hope not. Right now I am starting with an easy
>project. I just want to be able to search for 5 different products that
>each have qualities of there own.
>
>For instance CARS
>
>I want to have
>BRAND
>MODEL
>YEAR
>CONDITION
>PRICE
>
>Should I make a separate table for BRAND, a separate table for MODEL, a
>separate table for condition, and have one table that has
>BRAND,MODEL YEAR, CONDITION, AND PRICE. I think I am making this way more
>confusing than it is. What would be my advantage of making separate
>tables or justing making one table where I insert all the data. Eventually
>I want to be able to search for a type of car by every means possible (by
>brand,car, price, condition , year or all at the same time or any
>combination of them.
>
>Thank You
>Patrick Hahn
Received on Thu Dec 18 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US