简体   繁体   中英

Select primary key for two value

I am working on a library management system in Java.

My program has two state for login:

1: User mode

2: Admin mode

In Admin mode login (in my swing GUI window) , there are a button for showing the borrowed books.

Now, I am confusing to how implement it?

Should it display that which users borrowed which books ?

Or it should display that which books are borrowed ?

I know that it depends on my requirements, But i want know what it should be in general?

This is my borrowed book in Mysql command-line:

在此处输入图片说明在此处输入图片说明

Is this correct approach?

Should i display all my records in my JTable and then filter it by UserID ?

Like this? 在此处输入图片说明

Underlying IDs, which are database specific, in most cases, are not known to end users. They only feel comfortable referring to and working with readable and easily recognisable data in presentations.

Hence, it would be a better presentation, if you extract related book titles and user names and display them. And a search by partial user name or book name would be more appropriate for end user concerns.

And, dates should be handled using either date , datetime , or timestamp data types on column definitions. Using date functions on these type of columns would be comfortable than on varchar type data.

I think "which books are borrowed?" is better

I ll go with which books are borrowed by which user. And it should be able to sort by user so that I can see at a glance that a how many books a particular user has borrowed? Then I'll also put a limit to it as to a particular user can only borrow at the most 5 Books at a time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM