How to access database book checkout with a simple script?

Asked By 50 points N/A Posted on -
qa-featured

Hi,

I am developing a library system of our university. I want to know how to access database book checkout using a simple SQL command line. Thank you so much!

 

SHARE
Answered By 0 points N/A #197942

How to access database book checkout with a simple script?

qa-featured

 

Hello,
 
Although your question is very general, I would like to address it with the best possible way I can, taking an outside-in approach.
 
You haven't mentioned what type of database it is; Oracle, Informix, MySQL, etc. Since it is a database system, you do have to have available an interface to it from where you can run all sorts of SQL commands. Please have it available.
 
In order to construct SQL queries you need to know, or have access to documentation describing, the database structure. That is, you need to know the names of tables, the names of fields in each table, the type of data held by each field, relationships among different tables, etc.
 
As for an SQL query, here is an example for which we assume there are 2 tables named Students and Books. Of course, there will be many more in your complete solution.
 
Here are the tables with fields mentioned
 
Students
————
unique
student_id
department
book_id
 
Books
————-
id
name
ISBN
status
edition
last_checkout_date
due_date
 
So, given the above, here is how you can find out using SQL what books a particular student with id 1230090 has checked out from the library:
 
select * from Students, Books where Students.book_id=Books.id and student_id='1230090';
 
Hope it helps.
 
Best Regards,
Parisi Petrusic

Related Questions