Skip to main content

Track

Description

Table Definition
CREATE TABLE [Track]
(
[TrackId] INTEGER NOT NULL,
[Name] NVARCHAR(200) NOT NULL,
[AlbumId] INTEGER,
[MediaTypeId] INTEGER NOT NULL,
[GenreId] INTEGER,
[Composer] NVARCHAR(220),
[Milliseconds] INTEGER NOT NULL,
[Bytes] INTEGER,
[UnitPrice] NUMERIC(10,2) NOT NULL,
CONSTRAINT [PK_Track] PRIMARY KEY ([TrackId]),
FOREIGN KEY ([AlbumId]) REFERENCES [Album] ([AlbumId])
ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY ([GenreId]) REFERENCES [Genre] ([GenreId])
ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY ([MediaTypeId]) REFERENCES [MediaType] ([MediaTypeId])
ON DELETE NO ACTION ON UPDATE NO ACTION
)

Columns

NameTypeDefaultNullableChildrenParentsComment
TrackIdINTEGERfalseInvoiceLine PlaylistTrack
NameNVARCHAR(200)false
AlbumIdINTEGERtrueAlbum
MediaTypeIdINTEGERfalseMediaType
GenreIdINTEGERtrueGenre
ComposerNVARCHAR(220)true
MillisecondsINTEGERfalse
BytesINTEGERtrue
UnitPriceNUMERIC(10,2)false

Constraints

NameTypeDefinition
TrackIdPRIMARY KEYPRIMARY KEY (TrackId)
- (Foreign key ID: 0)FOREIGN KEYFOREIGN KEY (MediaTypeId) REFERENCES MediaType (MediaTypeId) ON UPDATE NO ACTION ON DELETE NO ACTION MATCH NONE
- (Foreign key ID: 1)FOREIGN KEYFOREIGN KEY (GenreId) REFERENCES Genre (GenreId) ON UPDATE NO ACTION ON DELETE NO ACTION MATCH NONE
- (Foreign key ID: 2)FOREIGN KEYFOREIGN KEY (AlbumId) REFERENCES Album (AlbumId) ON UPDATE NO ACTION ON DELETE NO ACTION MATCH NONE

Indexes

NameDefinition
IFK_TrackMediaTypeIdCREATE INDEX [IFK_TrackMediaTypeId] ON [Track] ([MediaTypeId])
IFK_TrackGenreIdCREATE INDEX [IFK_TrackGenreId] ON [Track] ([GenreId])
IFK_TrackAlbumIdCREATE INDEX [IFK_TrackAlbumId] ON [Track] ([AlbumId])

Relations

er