Hello,

I'll preface by saying this is a school project. I just need to be pointed in the right direction.

I'm trying to develop a database of books. In and of itself, that's simple enough, but I'm also trying to implement a tagging system following this solution.

Where I'm getting tripped up is with the fact that their solution uses one column as primary key per table. In order to prevent duplicate books from being added to my database, I'm thinking it would make sense for my primary key in the Books table to consist of both the Author name as well as the Title (since the same author can write more than one book, and different authors can write similarly-titled books, but no one author is going to write two books with the same title). The other two tables (Tags and TagMap) will only use a single-column primary key.

Would the linked solution work if the "Bookmark" table used a two-column primary key?

If not, do you have any better ideas for designing a table for books that would use a single-column primary key yet also prevent entry of duplicates? ISBN is not an option since many of the books in the table are independently published and are not registered.

Thanks

If not, do you have any better ideas for designing a table for books that would use a single-column primary key yet also prevent entry of duplicates?

Well I managed to take care of this by applying a generic serial number to each book entry to serve as the primary key. Then I created a unique key to prevent entry of duplicate titles. This allows me to use the linked solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.