Having trouble with keys in a database model -


i trying make database model, publish , subscribe features homework. using sqldbm modeling. can see model right below, i've got several tables connected tags. however, keys i'm worried about. in subscriptions table, tag_word , publisher_id should not displayed. other that, can describe model do, since homework , i'm not sure i've understood it.

you can see database model here sqldbm database modeling publish/subscribe feature

sql code:

    drop table [subscriptions]; go   drop table [publisher]; go   drop table [publications]; go   drop table [subscribers]; go   drop table [subscriber_interests]; go   drop table [publication_tags]; go   drop table [tags]; go    drop schema dbo; go   drop schema guest; go   drop schema db_owner; go   drop schema db_accessadmin; go   drop schema db_securityadmin; go   drop schema db_ddladmin; go   drop schema db_backupoperator; go   drop schema db_datareader; go   drop schema db_datawriter; go   drop schema db_denydatareader; go   drop schema db_denydatawriter; go   create schema dbo; go   create schema guest; go   create schema db_owner; go   create schema db_accessadmin; go   create schema db_securityadmin; go   create schema db_ddladmin; go   create schema db_backupoperator; go   create schema db_datareader; go   create schema db_datawriter; go   create schema db_denydatareader; go   create schema db_denydatawriter; go  --************************************** [tags]  create table [tags] (  [tag_word]         not null ,  [tag_description]  not null ,   constraint [pk_84] primary key clustered ([tag_word] asc) ); go    --************************************** [subscriber_interests]  create table [subscriber_interests] (  [subscriber_id]  not null ,  [tag_word]       not null ,   constraint [pk_101] primary key clustered ([subscriber_id] asc, [tag_word] asc),  constraint [fk_104] foreign key ([tag_word])   references [tags]([tag_word]) ); go   --skip index: [fkidx_104]   --************************************** [publication_tags]  create table [publication_tags] (  [publication_id]  not null ,  [tag_word]        not null ,   constraint [pk_94] primary key clustered ([publication_id] asc, [tag_word] asc),  constraint [fk_91] foreign key ([publication_id])   references [tags]([tag_word]) ); go   --skip index: [fkidx_91]   --************************************** [publications]  create table [publications] (  [publication_id]       not null ,  [publisher_id]         not null ,  [tag_word]             not null ,  [publication_details]  not null ,   constraint [pk_118] primary key clustered ([publication_id] asc, [publisher_id] asc, [tag_word] asc),  constraint [fk_127] foreign key ([publication_id], [tag_word])   references [publication_tags]([publication_id], [tag_word]) ); go   --skip index: [fkidx_127]   --************************************** [subscribers]  create table [subscribers] (  [subscriber_id]       not null ,  [tag_word]            not null ,  [subscriber_details]  not null ,   constraint [pk_109] primary key clustered ([subscriber_id] asc, [tag_word] asc),  constraint [fk_166] foreign key ([subscriber_id], [tag_word])   references [subscriber_interests]([subscriber_id], [tag_word]) ); go   --skip index: [fkidx_166]   --************************************** [subscriptions]  create table [subscriptions] (  [subscription_id]  not null ,  [tag_word]         not null ,  [publication_id]   not null ,  [publisher_id]     not null ,  [start_date]       not null ,  [end_date]         not null ,  [subscriber_id]    not null ,   constraint [pk_138] primary key clustered ([subscription_id] asc),  constraint [fk_154] foreign key ([subscriber_id], [tag_word])   references [subscribers]([subscriber_id], [tag_word]),  constraint [fk_159] foreign key ([publication_id], [publisher_id], [tag_word])   references [publications]([publication_id], [publisher_id], [tag_word]) ); go   --skip index: [fkidx_154]  --skip index: [fkidx_159]   --************************************** [publisher]  create table [publisher] (  [publisher_id]       not null ,  [publication_id]     not null ,  [tag_word]           not null ,  [publisher_details]  not null ,   constraint [pk_124] primary key clustered ([publisher_id] asc, [publication_id] asc, [tag_word] asc),  constraint [fk_131] foreign key ([publication_id], [publisher_id], [tag_word])   references [publications]([publication_id], [publisher_id], [tag_word]) ); go   --skip index: [fkidx_131] 


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -