473,385 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Tables and Relationships

A marketing company conducts auctions.
For each auction sale, there is a table (AUCTIONS)listing the auction
sale number, date, location, etc.
Another table (SELLERS)contains our client list (seller name, contact,
phone number, etc).
Information is directly input into the AUCTIONS and SELLERS tables.

A third table (CONTRACTS) should contain contract information (sale
number from the AUCTIONS table, seller name from the SELLERS table,
contract date, etc. The sale number and seller name are selected from
combo boxes.

A fourth table (LOTS) contains information for each lot like sale
number, seller name, property description, etc. There are multiple
lots for each seller in each sale.

How should the relations be setup?
Nov 13 '05 #1
2 1344
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The Contracts table should have a ContractID (AutoNumber if you like).
The relations would be like this:

Sellers - 1:m -> Contracts <- m:1 - Auctions

Contracts - 1:m -> Lots

In DDL (JET 3.x):

CREATE TABLE Sellers (
SellerID COUNTER ,
LastName VARCHAR(40) NOT NULL ,
FirstName VARCHAR(20) ,
... other columns ... ,
CONSTRAINT PK_Sellers PRIMARY KEY (LastName)
)
CREATE UNIQUE INDEX idx_Sellers ON Sellers (SellerID)

CREATE TABLE Auctions (
AuctionID COUNTER ,
SaleNumber INTEGER NOT NULL ,
SaleDate DATE NOT NULL ,
Location VARCHAR(50) NOT NULL ,
... other columns ... ,
CONSTRAINT PK_Auctions PRIMARY KEY (SaleNumber, SaleDate, Location)
)
CREATE UNIQUE INDEX idx_Auctions ON Auctions (AuctionID)

The primary key for Auctions could be just the SaleNumber, if each
SaleNumber should be unique. IOW, there cannot be the same SaleNumber
on different SaleDates, Locations.

CREATE TABLE Contracts (
ContractID COUNTER ,
AuctionID INTEGER NOT NULL REFERENCES Auctions ,
SellerID INTEGER NOT NULL REFERENCES Sellers ,
ContractDate DATE NOT NULL ,
... other columns ... ,
CONSTRAINT PK_Contracts
PRIMARY KEY (AuctionID, SellerID, ContractDate)
)
CREATE UNIQUE INDEX idx_Contracts ON Contracts (ContractID)

Here is where the relationships are defined between Contracts and
Auctions & Sellers.

The primary key could be just the AuctionID & SellerID if you allow more
than one record per ContractDate for the same Auction & Seller.

CREATE TABLE Lots (
AuctionID INTEGER NOT NULL REFERENCES Auctions ,
SellerID INTEGER NOT NULL REFERENCES Sellers ,
Descrip VARCHAR(500) NOT NULL ,
... other columns ... ,
CONSTRAINT PK_Lots PRIMARY KEY (AuctionID, SellerID)
)

Here is where the relationships are defined between Lots and Auctions &
Sellers.

If the Auctions.SellerNumber is unique then you can use the AuctionID as
the referrence to the SalesNumber in the Auctions table.

It may be that the SalesNumber and SalesDate should be in the Lots table
'cuz it seems the Auctions table should only have info about where &
when the Auction takes place. Therefore, the sale of each lot should
have the SalesNumber & the SalesDate in the same place as the Lot
information - the Lots table. That is my understanding of auctions - it
may be incorrect.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQUIiGYechKqOuFEgEQJEMgCghBbJZwTn5eo2RjBStGwht5 w1R/IAoLDc
ZTt+n5IHWXpC213xjZCmLBje
=VCwe
-----END PGP SIGNATURE-----
Mark wrote:
A marketing company conducts auctions.
For each auction sale, there is a table (AUCTIONS)listing the auction
sale number, date, location, etc.
Another table (SELLERS)contains our client list (seller name, contact,
phone number, etc).
Information is directly input into the AUCTIONS and SELLERS tables.

A third table (CONTRACTS) should contain contract information (sale
number from the AUCTIONS table, seller name from the SELLERS table,
contract date, etc. The sale number and seller name are selected from
combo boxes.

A fourth table (LOTS) contains information for each lot like sale
number, seller name, property description, etc. There are multiple
lots for each seller in each sale.

How should the relations be setup?


Nov 13 '05 #2
mr****@ogclearinghouse.com (Mark) wrote in message news:<9b**************************@posting.google. com>...
A marketing company conducts auctions.
For each auction sale, there is a table (AUCTIONS)listing the auction
sale number, date, location, etc.
Another table (SELLERS)contains our client list (seller name, contact,
phone number, etc).
Information is directly input into the AUCTIONS and SELLERS tables.

A third table (CONTRACTS) should contain contract information (sale
number from the AUCTIONS table, seller name from the SELLERS table,
contract date, etc. The sale number and seller name are selected from
combo boxes.

A fourth table (LOTS) contains information for each lot like sale
number, seller name, property description, etc. There are multiple
lots for each seller in each sale.

How should the relations be setup?


You're starting at the wrong place. You need to describe the PROCESS,
and NOT the tables. Do the table stuff later when you know what
entities you're dealing with. Something like

A Person (acting as SELLER) has something he wants to sell... He can
take many bids on the object.... etc

See? NO reference whatsoever to any database things at all. Start
there, and if you do it right, the database design should fall out.
But first things first. Get the story down. Tables come later once
you understand the "story".
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

44
by: Mariusz Jedrzejewski | last post by:
Hi, I'll be very grateful if somebody can explain me why my Opera 7.23 (runing under linux) doesn't show me inner tables. Using below code I can see only "inner table 1". There is no problem with...
11
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
10
by: Richard | last post by:
Hi folks, thanks for taking the time to read this (and hopefully point our where I'm going wrong). The scenario: I have a local Access2007 database which links in several read only mySql...
2
by: Roger | last post by:
I've moved all my tables to sql server2005 and I've created the appropriate relationships now I create links to two such tables that have a relationship into ms- acess97 but when I add the two...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.