Database reference - AdventureWorks

AdventureWorks -  tables -  [Sales].[Store]

Description

Customers (resellers) of Adventure Works products. 

Table properties

namevalue
name[Sales].[Store]
createdMar 19 2009 9:08PM
modifiedMar 19 2009 9:08PM 
ansi nullson 
quoted identifieron 
row count701
Size of data808 kb
Size of indexes80 kb
Maximum size of a single row2,147,483,878 bytes

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
CustomerIDint104 no  yes  Customer.CustomerID      no  Primary key. Foreign key to Customer.CustomerID. 
NameName50200 no      no  Name of the store. 
SalesPersonIDint104 yes    SalesPerson.SalesPersonID      no  ID of the sales person assigned to the customer. Foreign key to SalesPerson.SalesPersonID. 
Demographicsxmlmax2147483646 yes      no  Demographic informationg about the store such as the number of employees, annual sales and store type. 
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_Store_rowguidnonclustered, unique located on PRIMARYrowguidUnique nonclustered index. Used to support replication samples. 
IX_Store_SalesPersonIDnonclustered located on PRIMARYSalesPersonIDNonclustered index. 
PK_Store_CustomerIDclustered, unique, primary key located on PRIMARYCustomerIDClustered index created by a primary key constraint. 
PXML_Store_DemographicsDemographics 

References

name
Customer
SalesPerson

Referenced by

name
StoreContact

Foreign key graph

CustomerSalesPersonStoreStoreContact

Foreign keys

namecolumnsforeign columnstypecomment
FK_Store_Customer_CustomerIDCustomerIDCustomer.CustomerID   Foreign key constraint referencing Customer.CustomerID. 
FK_Store_SalesPerson_SalesPersonIDSalesPersonIDSalesPerson.SalesPersonID   Foreign key constraint referencing SalesPerson.SalesPersonID 

Triggers

namecomment
iStoreAFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table. 

Defaults

default namecolumncomment
DF_Store_rowguidrowguidDefault constraint value of NEWID() 
DF_Store_ModifiedDateModifiedDateDefault constraint value of GETDATE() 

Dependency graph

Objects that [Sales].[Store] depends on

nameobject typelevel
Nametype1

Objects that depend on [Sales].[Store]

nameobject typelevel
iStoretrigger1
iuIndividualtrigger1
vStoreWithDemographicsview1

Sample rows

CustomerIDNameSalesPersonIDDemographicsrowguidModifiedDate
A Bike Store  280  <StoreSurvey xmlns="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey"><Ann...  80b15702-df20-4df9-876c-2cf1c3978d39  10/13/2004 11:15:07 AM 
Progressive Sports  283  <StoreSurvey xmlns="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey"><Ann...  e88b2a4c-72d3-4818-9f94-c59633d66ce8  10/13/2004 11:15:07 AM 
Advanced Bike Components  277  <StoreSurvey xmlns="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey"><Ann...  42bdf4b8-bff2-4a04-b0d3-ebb5896025ce  10/13/2004 11:15:07 AM 
Modular Cycle Systems  277  <StoreSurvey xmlns="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey"><Ann...  a232dae8-2411-4fdc-bbb2-6eb5f547986b  10/13/2004 11:15:07 AM 
Metropolitan Sports Supply  281  <StoreSurvey xmlns="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey"><Ann...  058dea7c-58fd-42e5-a199-b19c669e985c  10/13/2004 11:15:07 AM 
Aerobic Exercise Company  276  <StoreSurvey xmlns="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey"><Ann...  690b6d1f-f71e-4bb8-b87d-baeb505135ef  10/13/2004 11:15:07 AM 
Associated Bikes  281  <StoreSurvey xmlns="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey"><Ann...  22e7c8dd-5feb-4b87-abf2-d87bc0aa4695  10/13/2004 11:15:07 AM 
Exemplary Cycles  279  <StoreSurvey xmlns="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey"><Ann...  ab2ab66c-9002-4a91-96c9-2e9cb0881e96  10/13/2004 11:15:07 AM 
Tandem Bicycle Store  279  <StoreSurvey xmlns="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey"><Ann...  b6437d59-886a-4aa2-8463-62bbfb9e0c65  10/13/2004 11:15:07 AM 
10  Rural Cycle Emporium  282  <StoreSurvey xmlns="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/StoreSurvey"><Ann...  59deae0a-7b98-4b25-9431-1be36365167f  10/13/2004 11:15:07 AM 

Code

CREATE TABLE [Sales].[Store](
    [CustomerID] [int] NOT NULL,
    [Name] [dbo].[Name] NOT NULL,
    [SalesPersonID] [int] NULL,
    [Demographics] [xml](CONTENT [Sales].[StoreSurveySchemaCollection]) NULL,
    [rowguid] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
    [CustomerID] [int] NOT NULL,
    [Name] [dbo].[Name] NOT NULL,
    [SalesPersonID] [int] NULL,
    [Demographics] [xml](CONTENT [Sales].[StoreSurveySchemaCollection]) NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_Store_CustomerID] PRIMARY KEY CLUSTERED 
(
    [CustomerID] 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].[Store]  WITH CHECK ADD  CONSTRAINT [FK_Store_Customer_CustomerID] FOREIGN KEY([CustomerID])
REFERENCES [Sales].[Customer] ([CustomerID])
ALTER TABLE [Sales].[Store] CHECK CONSTRAINT [FK_Store_Customer_CustomerID]
ALTER TABLE [Sales].[Store]  WITH CHECK ADD  CONSTRAINT [FK_Store_SalesPerson_SalesPersonID] FOREIGN KEY([SalesPersonID])
REFERENCES [Sales].[SalesPerson] ([SalesPersonID])
ALTER TABLE [Sales].[Store] CHECK CONSTRAINT [FK_Store_SalesPerson_SalesPersonID]
ALTER TABLE [Sales].[Store] ADD  CONSTRAINT [DF_Store_rowguid]  DEFAULT (newid()) FOR [rowguid]
ALTER TABLE [Sales].[Store] ADD  CONSTRAINT [DF_Store_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]

Powered by Yoyodyne © 1971