Click here to Skip to main content
15,894,907 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi..I am currently working on a project on Library Management System. I ve created a database to store the books in the Library. While adding books, i want to add multiple copies of the same book. i need to create a unique book ID for each book..how can i make multiple entries of the same book wid different IDs for each?

eg., Book name: Engineering Thermodynamics
Author: P K Nag
Publisher: ABC
Edition: 2
Category: Mechanical Engineering
Quantity: 5

i need to add this data to the database making 5 different entries for the same book wid a unique ID. Plz help me!
Posted
Updated 2-Mar-13 11:16am
v2
Comments
[no name] 2-Mar-13 13:20pm    
Okay so create a unique ID for each entry.... A GUID springs top mind but no one but you know anything about your database or what you would consider to be a unique ID.....

1 solution

Off the top of my head without any detailed analysis, I believe you should have multiple tables. Study what I entered below and expand with information gathered from your customer.

Table 1 - Titles (One entry per title)
ID IsIdentity
CategoryID Foreign Key ID of Table 4 - Category
Title
Edition
Author Foreign Key ID of Table 5 - Author
Publisher Foreign Key ID of Table 6 - Publisher
Publication Year
Keywords
Synopsis
LOC Number
ISBN Number
Call Number

Table 2 - Branch (Each library branch location)
ID IsIdentity
Name
Address
City
State
Zip
Phone
EmailAddress

Table 3 - Customer (Each person with a library card)
ID IsIdentity
Name
Address
City
State
Zip
Phone
EmailAddress
LibraryCardNumber
LibraryCardIssuedDate
LibraryCardExpiresDate

Table 4 - Category (Fiction, Non-Fiction, History, etc.)
ID IsIdentity
CategoryName

Table 5 - Author (Book Author)
ID IsIdentity
Name
Birth Year
Death Year

Table 6 - Publisher (Book Publisher)
ID IsIdentity
Name
Address
City
State
Zip
Phone
EmailAddress

Table 6 - CopiesOfTitle (Each copy of a title)
ID IsIdentity
TitleId Foreign Key Id of Table 1 - Titles
BranchID Foreign Key Id of Table 2 - Branch
Condition
Acquisition Cost
Acquisition Date
CheckedOutByID Foreign Key Id of Table 3 - Customer
DateDue

Table 7 - CustomerFines (History of fines paid and unpaid)
ID IsIdentity
CustomerID Foreign Key ID of Table 3 - Customer
BookID Foreign Key ID of Table 6 - CopiesOfTitle
FineDate
FineValue
FineDays
FineWaived
PaidValue
PaidDate
TimesNotified
 
Share this answer
 
v7

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900