Database reference - AdventureWorks2008

AdventureWorks2008 -  tables -  [Sales].[SalesPersonQuotaHistory]

Description

Sales performance tracking. 

Table properties

namevalue
name[Sales].[SalesPersonQuotaHistory]
createdMar 19 2009 9:09PM
modifiedMar 19 2009 9:10PM 
ansi nullson 
quoted identifieron 
row count163
Size of data16 kb
Size of indexes32 kb
Maximum size of a single row44 bytes

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
BusinessEntityIDint104 no  composite PK  SalesPerson.BusinessEntityID      no  Sales person identification number. Foreign key to SalesPerson.BusinessEntityID. 
QuotaDatedatetime238 no  composite PK    no  Sales quota date. 
SalesQuotamoney198 no      no  Sales quota amount. 
rowguiduniqueidentifier3616(newid())no      no  ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. 
ModifiedDatedatetime238(getdate())no      no  Date and time the record was last updated. 

Indexes

namedescriptioncolumncomment
AK_SalesPersonQuotaHistory_rowguidnonclustered, unique located on PRIMARYrowguidUnique nonclustered index. Used to support replication samples. 
PK_SalesPersonQuotaHistory_BusinessEntityID_QuotaDateclustered, unique, primary key located on PRIMARYBusinessEntityID, QuotaDateClustered index created by a primary key constraint. Does it really need to be clustered? 

References

name
SalesPerson

Foreign key graph

SalesPersonSalesPersonQuotaHistory

Foreign keys

namecolumnsforeign columnstypecomment
FK_SalesPersonQuotaHistory_SalesPerson_BusinessEntityIDBusinessEntityIDSalesPerson.BusinessEntityID   Foreign key constraint referencing SalesPerson.SalesPersonID. 

Check constraints

namecolumncomment
CK_SalesPersonQuotaHistory_SalesQuotaSalesQuota    Check constraint [SalesQuota] > (0.00) 

Defaults

default namecolumncomment
DF_SalesPersonQuotaHistory_rowguidrowguidDefault constraint value of NEWID() 
DF_SalesPersonQuotaHistory_ModifiedDateModifiedDateDefault constraint value of GETDATE() 

Dependency graph

DF_SalesPersonQuotaHistory_ModifiedDateDF_SalesPersonQuotaHistory_rowguidSalesPersonQuotaHistoryCK_SalesPersonQuotaHistory_SalesQuotaAK_SalesPersonQuotaHistory_rowguid...PK_SalesPersonQuotaHistory_BusinessEntityID_QuotaD...

Sample rows

BusinessEntityIDQuotaDateSalesQuotarowguidModifiedDate
274  7/1/2001 12:00:00 AM  28000.0000  99109bbf-8693-4587-bc23-6036ec89e1be  5/17/2001 12:00:00 AM 
274  10/1/2001 12:00:00 AM  7000.0000  dfd01444-8900-461c-8d6f-04598dae01d4  8/17/2001 12:00:00 AM 
274  1/1/2002 12:00:00 AM  91000.0000  0a69f453-9689-4ccf-a08c-c644670f5668  11/17/2001 12:00:00 AM 
274  4/1/2002 12:00:00 AM  140000.0000  da8d1458-5fb9-4c3e-9ead-8f5ce1393047  2/15/2002 12:00:00 AM 
274  7/1/2002 12:00:00 AM  70000.0000  760cef84-b980-417b-a667-7358c38857f0  5/17/2002 12:00:00 AM 
274  10/1/2002 12:00:00 AM  154000.0000  fb29e024-f26a-49aa-a7cc-c99ae7ba4853  8/17/2002 12:00:00 AM 
274  1/1/2003 12:00:00 AM  107000.0000  13947d2c-a254-47c9-8817-cbd186ffa526  11/17/2002 12:00:00 AM 
274  4/1/2003 12:00:00 AM  58000.0000  bc1a222f-47a0-48d1-9c56-ac873269dc98  2/15/2003 12:00:00 AM 
274  7/1/2003 12:00:00 AM  263000.0000  8b4e3cbf-f0ef-49c5-9a8c-87679055057e  5/17/2003 12:00:00 AM 
274  10/1/2003 12:00:00 AM  116000.0000  e9de95e3-b119-4441-bd1d-b27fc4516022  8/17/2003 12:00:00 AM 

Code

CREATE TABLE [Sales].[SalesPersonQuotaHistory](
    [BusinessEntityID] [int] NOT NULL,
    [QuotaDate] [datetime] NOT NULL,
    [SalesQuota] [money] NOT NULL,
    [rowguid] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
    [BusinessEntityID] [int] NOT NULL,
    [QuotaDate] [datetime] NOT NULL,
    [SalesQuota] [money] NOT NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_SalesPersonQuotaHistory_BusinessEntityID_QuotaDate] PRIMARY KEY CLUSTERED 
(
    [BusinessEntityID] ASC,
    [QuotaDate] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

ALTER TABLE [Sales].[SalesPersonQuotaHistory]  WITH CHECK ADD  CONSTRAINT [FK_SalesPersonQuotaHistory_SalesPerson_BusinessEntityID] FOREIGN KEY([BusinessEntityID])
REFERENCES [Sales].[SalesPerson] ([BusinessEntityID])
ALTER TABLE [Sales].[SalesPersonQuotaHistory] CHECK CONSTRAINT [FK_SalesPersonQuotaHistory_SalesPerson_BusinessEntityID]
ALTER TABLE [Sales].[SalesPersonQuotaHistory]  WITH CHECK ADD  CONSTRAINT [CK_SalesPersonQuotaHistory_SalesQuota] CHECK  (([SalesQuota]>(0.00)))
ALTER TABLE [Sales].[SalesPersonQuotaHistory] CHECK CONSTRAINT [CK_SalesPersonQuotaHistory_SalesQuota]
ALTER TABLE [Sales].[SalesPersonQuotaHistory] ADD  CONSTRAINT [DF_SalesPersonQuotaHistory_rowguid]  DEFAULT (newid()) FOR [rowguid]
ALTER TABLE [Sales].[SalesPersonQuotaHistory] ADD  CONSTRAINT [DF_SalesPersonQuotaHistory_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]



Documentation generated by SqlSpec