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 7180229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:18:14+00:00 2026-05-28T17:18:14+00:00

I have a simple question related to database schema, how can I check whether

  • 0

I have a simple question related to database schema, how can I check whether a student has borrowed a particular book, let say I have a table Borrowtable and I have Student_id,Book_id…. as attributes of that table, what else i should add in order to keep track whether the student_id has borrowed a book ???

I am thinkin to add another field like Status as INT field and values like 1 for borrowed and 0 not borrow. Is this good idea or there is another way of doing this?

Thankx

Lulzim.

  • 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-05-28T17:18:15+00:00Added an answer on May 28, 2026 at 5:18 pm

    Edited for two scenarios

    Scenario 1: not storing a borrowing history:

    This applies if you have no need to keep track of the user’s borrowing history. Borrowed books are one-off events, and are not remembered.

    If you already have a Borrowtable containing a map between Student_id and Book_id, there is no need for another column to indicate borrowed or not borrowed.

    Instead, you can simply rely on the presence of the row containing the student and book. If the row exists, the book has been
    borrowed. If the row has been deleted or does not exist, the book has not been borrowed.

    To test if a book is available for borrowing by any user, simply check if the Book_id exists anywhere in the table. If it does, the book is unavailable.

    Scenario 2: store a user’s borrowing history:

    If you need to keep track of what a user has borrowed, add two more columns, each of DATETIME type to track the borrowed date and the returned date for the book.

    To test if a book is available for borrowing, use a query like:

    SELECT Book_id FROM Borrowed WHERE Book_id=12345 AND NOW() BETWEEN Borrow_Date AND Return_Date;
    

    If any row returns, then the book is currently borrowed and unavailable for use.

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

Sidebar

Related Questions

I have an HBase schema-design related question. The problem is fairly simple - I
I have a simple question related to one-line programming. First an example: function test(a)
I have a very simple question. Is there any way to relate database errors
My question is related to Database Design for Revisions? but more complicated. I have
I have a simple question. Is there a way ( using reflections I suppose
I have a simple question and wish to hear others' experiences regarding which is
I have a simple question about Java's XML API and I hope there's a
I have a simple question, but I'm about 80% sure that the answer to
I have a simple question that I am posing mostly for my curiousity. What
i have pretty simple simple question (i hope so). How do i change the

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.