Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9170107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:58:16+00:00 2026-06-17T15:58:16+00:00

My question involves databases – The scenario is this: I have an app that

  • 0

My question involves databases – The scenario is this:

I have an app that tracks when people borrow items. I have an existing table which tracks who they are, what they have borrowed and so on. What I would like to do is create a separate table to track what the person has borrowed, their contact info, if they returned it, etc.

My idea to do this would be to create a Dynamic table in SQL that would hold the records for 1 person, ie

John Smith
DVD; July 12, 2012; Returned in good condition; etc

As I’m still learning, I wanted to know if:

This is possible, feasible or if there is a smarter way of going about it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:58:17+00:00Added an answer on June 17, 2026 at 3:58 pm

    Your answer depends on your scenario;

    If you are only interested with “who” borrowed “what” (currently) and not “when” except last occurance, and you are assuming there are always only 1 copy of an item, then you can use one to one relation as:

    CREATE TABLE Person
    (
        PersonId        int IDENTITY(1,1)   NOT NULL,
        Name            nvarchar(30)        NOT NULL,
        Surname         nvarchar(30)        NOT NULL,
        BorrowItemId    int                 NULL FOREIGN KEY REFERENCES Item UNIQUE,
        BorrowDate      datetime            NULL,
        ReturnDate      datetime            NULL,
        ReturnCondition nvarchar(50)        NULL,
        CONSTRAINT PK_Person PRIMARY KEY CLUSTERED (PersonId ASC),
    )
    CREATE TABLE Item
    (
        ItemId          int IDENTITY(1,1)   NOT NULL,
        ItemDescription nvarchar(50)        NOT NULL,
        CONSTRAINT [PK_Item] PRIMARY KEY CLUSTERED (ItemId ASC)
    )
    

    If you have multiple copies of each item you should remove the UNIQUE key on BorrowItemId changing relation to one to many. In case;

    To see the items borrowed and returned with person information:

    SELECT PersonId, Name, Surname, ItemDescription, ReturnDate, ReturnCondition
    FROM Person INNER JOIN Item
        ON BorrowItemId = ItemId
    WHERE BorrowItemId IS NOT NULL 
        AND ReturnDate IS NOT NULL
    

    You can add PersonId filter in WHERE clause to query for specific person

    This isn’t a good design since you can insert records without date information or you can even have records with date info but no related BorrowItemId. I suggest using many to many and keep historic data (can be handy) or overwrite using update each time the person borrows a new item

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is more a general question but my particular case involves a ruby/rails app
Let us take this example scenario: There exists a really complex function that involves
This question involves Delphi and XE specifically deprecating Suspend and Resume. I have read
I have a question that relates to setting up the third table ( Repair_Parts
This question is abit similar to my shared preferences question only that it involves
This question involves 3 tables and 1 form in my Access database. The tables
My question involves this simple walkthrough shown in the article Preserve Size and Location
I have a question which involves calling a function with 2 parameters of a
I have a question which I think involves conditional entropy in the field of
This is mostly a data warehouse philosophy question. My project involves an Oracle forms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.