I think you might want a few more tables.  You can't keep much data (or keep
much data normalized) with what you've got.  I'd do something like this.

customers
    cust_id    (PRIMARY KEY)
    l_name
    f_name
    acct_bal

stocks
    stock_id    (PRIMARY KEY)
    name
    price
    shares_total
    shares_avail

transactions
    trans_id    (PRIMARY KEY)
    seller_id
    buyer_id
    share_id
    share_price
    share_volume
    trans_date


You could potentially use two tables for transactions (sales, purchases), which
might be a good idea if there can be multiple buyers for a single stock sale.
It's just as easy to declare each a different transaction, though, which may or
may not be what you want.

You might want to consider some books on data modeling.  The books by Len
Silverston are supposed to be good.  I can't give my opinion bcs they haven't
arrived yet, but I bought both based on the great user reviews at Amazon.  Here
are links to both.
http://www.amazon.com/exec/obidos/tg/detail/-/0471380237/102-5674589-9040158
http://www.amazon.com/exec/obidos/tg/detail/-/0471353485/102-5674589-9040158

Good luck!

Edward Dudlik
Becoming Digital
www.becomingdigital.com


----- Original Message -----
From: "Thomas Kvamme" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, 10 June, 2003 07:17
Subject: Tips & Hints regarding DB/App design


Hi All,

Needs some tips & hints on how to "BEST" design a spesific database.

I have a customer table containing the following fields (just an example):

    CustomerID            -  The customers ID Number
    AccountBalance     - The customers Account Blanace / or available funds if
you like
    StockVolume        - The number of Stocks hold by the customer

Now I want to make an application where all the customer can trade stocks with
each other.

My first idea was to use 2 tables 1 table holding all the stocks on sales and
another table
holding the stocks for bying.

example:

    Table: stocksales

        CustomerID
        StockVolume
        SalesPrice


    Table: stockpurchase

        CustomerID
        StockVolume
        PurchasePrice


This application will of course be used by many customers at the same time...

How to best handle this in MySQL ?  What if several customers tries to buy the
same stocks at the same time ?? Any locking methods?

Any hints & tips to best design such an database and/or application I'll
appreciate it.

I'm open for any suggestions.

If it does matter:  I'm going to use MySQL & Delphi Enterprise 6

Kind Regards
Thomas Kvamme


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to