Database reference - AdventureWorks2008

AdventureWorks2008 -  tables -  [Production].[ProductSubcategory]

Description

Product subcategories. See ProductCategory table. 

Table properties

namevalue
name[Production].[ProductSubcategory]
createdMar 19 2009 9:09PM
modifiedMar 19 2009 9:10PM 
ansi nullson 
quoted identifieron 
row count37
Size of data8 kb
Size of indexes40 kb
Maximum size of a single row232 bytes

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
ProductSubcategoryIDint identity(1,1)104 no  yes    no  Primary key for ProductSubcategory records. 
ProductCategoryIDint104 no    ProductCategory.ProductCategoryID      no  Product category identification number. Foreign key to ProductCategory.ProductCategoryID. 
NameName50200 no      no  Subcategory description. 
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_ProductSubcategory_Namenonclustered, unique located on PRIMARYNameUnique nonclustered index. 
AK_ProductSubcategory_rowguidnonclustered, unique located on PRIMARYrowguidUnique nonclustered index. Used to support replication samples. 
PK_ProductSubcategory_ProductSubcategoryIDclustered, unique, primary key located on PRIMARYProductSubcategoryIDClustered index created by a primary key constraint. 

References

name
ProductCategory

Referenced by

name
Product

Foreign key graph

ProductCategoryProductSubcategoryProduct

Foreign keys

namecolumnsforeign columnstypecomment
FK_ProductSubcategory_ProductCategory_ProductCategoryIDProductCategoryIDProductCategory.ProductCategoryID   Foreign key constraint referencing ProductCategory.ProductCategoryID. 

Defaults

default namecolumncomment
DF_ProductSubcategory_rowguidrowguidDefault constraint value of NEWID() 
DF_ProductSubcategory_ModifiedDateModifiedDateDefault constraint value of GETDATE() 

Dependency graph

DF_ProductSubcategory_ModifiedDateDF_ProductSubcategory_rowguidNameProductSubcategoryAK_ProductSubcategory_Name...AK_ProductSubcategory_rowguid...PK_ProductSubcategory_ProductSubcategoryID...Company Sales 2008Employee Sales Summary 2008Product Catalog 2008Product Catalog 2008;2Product Line Sales 2008Sales Trend 2008

Objects that [Production].[ProductSubcategory] depends on

nameobject typedatabaseserverlevel
NametypeAdventureWorks2008SPRING\KATMAI1

Objects that depend on [Production].[ProductSubcategory]

nameobject typedatabaseserverlevel
Company Sales 2008Reportreportserver_katmaiSPRING1
Employee Sales Summary 2008Reportreportserver_katmaiSPRING1
Product Catalog 2008Reportreportserver_katmaiSPRING1
Product Catalog 2008;2Reportreportserver_katmaiSPRING1
Product Line Sales 2008Reportreportserver_katmaiSPRING1
Sales Trend 2008Reportreportserver_katmaiSPRING1

Sample rows

ProductSubcategoryIDProductCategoryIDNamerowguidModifiedDate
Mountain Bikes  2d364ade-264a-433c-b092-4fcbf3804e01  6/1/1998 12:00:00 AM 
Road Bikes  000310c0-bcc8-42c4-b0c3-45ae611af06b  6/1/1998 12:00:00 AM 
Touring Bikes  02c5061d-ecdc-4274-b5f1-e91d76bc3f37  6/1/1998 12:00:00 AM 
Handlebars  3ef2c725-7135-4c85-9ae6-ae9a3bdd9283  6/1/1998 12:00:00 AM 
Bottom Brackets  a9e54089-8a1e-4cf5-8646-e3801f685934  6/1/1998 12:00:00 AM 
Brakes  d43ba4a3-ef0d-426b-90eb-4be4547dd30c  6/1/1998 12:00:00 AM 
Chains  e93a7231-f16c-4b0f-8c41-c73fdec62da0  6/1/1998 12:00:00 AM 
Cranksets  4f644521-422b-4f19-974a-e3df6102567e  6/1/1998 12:00:00 AM 
Derailleurs  1830d70c-aa2a-40c0-a271-5ba86f38f8bf  6/1/1998 12:00:00 AM 
10  Forks  b5f9ba42-b69b-4fdd-b2ec-57fb7b42e3cf  6/1/1998 12:00:00 AM 

Code

CREATE TABLE [Production].[ProductSubcategory](
    [ProductSubcategoryID] [int] IDENTITY(1,1) NOT NULL,
    [ProductCategoryID] [int] NOT NULL,
    [Name] [dbo].[Name] NOT NULL,
    [ProductSubcategoryID] [int] IDENTITY(1,1) NOT NULL,
    [ProductCategoryID] [int] NOT NULL,
    [rowguid] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_ProductSubcategory_ProductSubcategoryID] PRIMARY KEY CLUSTERED 
(
    [ProductSubcategoryID] 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 [Production].[ProductSubcategory]  WITH CHECK ADD  CONSTRAINT [FK_ProductSubcategory_ProductCategory_ProductCategoryID] FOREIGN KEY([ProductCategoryID])
REFERENCES [Production].[ProductCategory] ([ProductCategoryID])
ALTER TABLE [Production].[ProductSubcategory] CHECK CONSTRAINT [FK_ProductSubcategory_ProductCategory_ProductCategoryID]
ALTER TABLE [Production].[ProductSubcategory] ADD  CONSTRAINT [DF_ProductSubcategory_rowguid]  DEFAULT (newid()) FOR [rowguid]
ALTER TABLE [Production].[ProductSubcategory] ADD  CONSTRAINT [DF_ProductSubcategory_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]



Documentation generated by SqlSpec