Easy- Interview Question - table design

Last Post 27 Apr 2006 05:20 AM by sqladmin. 4 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
eramgarden_SQL
New Member
New Member

--
14 Feb 2006 10:22 AM
I have this interview question and wanted to get some thoughts on it:

" You have an order and line items for that order. The order will contain a customer billing and shipping information and a unique Order number. Each line item will have a part number, description, price, and cost and a unique identifier that cannot be duplicated.. The order will have a one-to-many relationship with line items. Please define a database scheme that will support these requirements.
"
SQLUSA
New Member
New Member

--
19 Feb 2006 02:54 AM
This is pretty standard:


create table OrderHeader( OrderID int identity(1,1), ...one-time-info-columns,...)

create table OrderDetail (OrderDetailID int identity(1,1), OrderID int, ....order-detail-line-items....)


Kalman Toth, Database, Data Warehouse and BI Architect
http://www.sqlusa.com/orderdoubleheader/
The Best SQL Server 2005 Training in the World
davidmcf
New Member
New Member

--
13 Apr 2006 02:07 AM
Based on your wording, I'm getting the impression that you're looking for a GUID in the lineitem table, and therefore want them to use the uniqueidentifier datatype. If that's the case, I'd be much more explicit with the phrase "unique identifier that cannot be duplicated", and say something like "an identifier that is unique across the entire database". The problem with the word unique is that it means different things to different people, and is highly dependent on scope, so be specific about just what sort of uniqueness you are looking for.
sqladmin
New Member
New Member

--
27 Apr 2006 05:20 AM
i agree with davidmcf... wording is crucial. could just say a unique id which is what sqlusa has
down there when he defines the column with (...int identity (1,1))

sqladmin
New Member
New Member

--
27 Apr 2006 05:34 AM
eramgarden_SQL... post the table that you 'expect' to be created.
You are not authorized to post a reply.

Acceptable Use Policy