First page Back Continue Last page Image

Building a Database – Purchase

salestransaction

stxid

int(5)

PK

Not Null

productid

int(5)

FK

Not Null

customerid

int(5)

FK

Not Null

employeeid

int(5)

FK

Null

saledate

date

Not Null

saleamount

dec()

Not Null

product

prdid

int(5)

PK

Not Null

prdname

vc()

Not Null

prddesc

vc()

Null

prdinventory

int(5)

Null

prcost

dec()

Null

This is great we can now sell something – but this is only half the story, we have to be able to purchase supplies

We have shifted our display to the left, Customer and Employee are still there just off the screen to the right

purchasetransaction

purchid

int(5)

PK

Not Null

partid

int(5)

FK

Not Null

invoicenbr

int(5)

Null

vendorid

int(5)

FK

Null

employeeid

int(5)

FK

Null

purchdate

date

Not Null

purchamt

dec()

Not Null

If you purchase items for resale as is, then you can make this relationship connection

inventory

But it is more likely you assemble parts to create a new product, so you will have something like this