Description
Cross-reference table mapping products and product photos.
Table properties
| name | value |
|---|
| name | [Production].[ProductProductPhoto] |
| created | Mar 19 2009 9:09PM |
| modified | Mar 19 2009 9:10PM
|
| ansi nulls | on
|
| quoted identifier | on
|
| row count | 504 |
| Size of data | 16 kb |
| Size of indexes | 40 kb |
| Maximum size of a single row | 16 bytes |
Columns
| column | datatype | length | bytes | default | nulls | PK | FK | UQ | computed | comment |
|---|
| ProductID | int | 10 | 4 | | no
| composite PK
| Product.ProductID
|
| no
| Product identification number. Foreign key to Product.ProductID.
|
| ProductPhotoID | int | 10 | 4 | | no
| composite PK
| ProductPhoto.ProductPhotoID
|
| no
| Product photo identification number. Foreign key to ProductPhoto.ProductPhotoID.
|
| Primary | Flag | 1 | 0 | ((0)) | no
|
| |
| no
| 0 = Photo is not the principal image. 1 = Photo is the principal image.
|
| ModifiedDate | datetime | 23 | 8 | (getdate()) | no
|
| |
| no
| Date and time the record was last updated.
|
Indexes
References
Foreign key graph
Foreign keys
| name | columns | foreign columns | type | comment |
|---|
| FK_ProductProductPhoto_Product_ProductID | ProductID | Product.ProductID |
| Foreign key constraint referencing Product.ProductID.
|
| FK_ProductProductPhoto_ProductPhoto_ProductPhotoID | ProductPhotoID | ProductPhoto.ProductPhotoID |
| Foreign key constraint referencing ProductPhoto.ProductPhotoID.
|
Defaults
Dependency graph
Objects that [Production].[ProductProductPhoto] depends on
| name | object type | database | server | level |
|---|
| Flag | type | AdventureWorks2008 | SPRING\KATMAI | 1 |
Objects that depend on [Production].[ProductProductPhoto]
Sample rows
| ProductID | ProductPhotoID | Primary | ModifiedDate |
|---|
| 1
| 1
| True
| 5/2/1998 12:00:00 AM
|
| 2
| 1
| True
| 5/2/1998 12:00:00 AM
|
| 3
| 1
| True
| 5/2/1998 12:00:00 AM
|
| 4
| 1
| True
| 5/2/1998 12:00:00 AM
|
| 316
| 1
| True
| 5/2/1998 12:00:00 AM
|
| 317
| 1
| True
| 5/2/1998 12:00:00 AM
|
| 318
| 1
| True
| 5/2/1998 12:00:00 AM
|
| 319
| 1
| True
| 5/2/1998 12:00:00 AM
|
| 320
| 1
| True
| 5/2/1998 12:00:00 AM
|
| 321
| 1
| True
| 5/2/1998 12:00:00 AM
|
Code
CREATE TABLE [Production].[ProductProductPhoto](
[ProductID] [int] NOT NULL,
[ProductPhotoID] [int] NOT NULL,
[Primary] [dbo].[Flag] NOT NULL,
[ModifiedDate] [datetime] NOT NULL,
CONSTRAINT [PK_ProductProductPhoto_ProductID_ProductPhotoID] PRIMARY KEY NONCLUSTERED
(
[ProductID] ASC,
[ProductPhotoID] 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].[ProductProductPhoto] WITH CHECK ADD CONSTRAINT [FK_ProductProductPhoto_Product_ProductID] FOREIGN KEY([ProductID])
REFERENCES [Production].[Product] ([ProductID])
ALTER TABLE [Production].[ProductProductPhoto] CHECK CONSTRAINT [FK_ProductProductPhoto_Product_ProductID]
ALTER TABLE [Production].[ProductProductPhoto] WITH CHECK ADD CONSTRAINT [FK_ProductProductPhoto_ProductPhoto_ProductPhotoID] FOREIGN KEY([ProductPhotoID])
REFERENCES [Production].[ProductPhoto] ([ProductPhotoID])
ALTER TABLE [Production].[ProductProductPhoto] CHECK CONSTRAINT [FK_ProductProductPhoto_ProductPhoto_ProductPhotoID]
ALTER TABLE [Production].[ProductProductPhoto] ADD CONSTRAINT [DF_ProductProductPhoto_Primary] DEFAULT ((0)) FOR [Primary]
ALTER TABLE [Production].[ProductProductPhoto] ADD CONSTRAINT [DF_ProductProductPhoto_ModifiedDate] DEFAULT (getdate()) FOR [ModifiedDate]