N/APosted on - 02/02/2013
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!
How to access database book checkout with a simple script?
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
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.