Library Management System (Using Database)

Hello Everyone,

I am back with another database project which was finalized 2 days back and this time I worked on Library Management using database.

Here’s a brief video on it:

So without much talking, let’s dive into the project.

To begin with, following are the tables which have been used in this project:

  1. BOOKS (Details about books in library):
Column Datatype
Book_ID VARCHAR2(10 CHAR)
Book_Title VARCHAR2(300 CHAR)
Book_Author VARCHAR2(50 CHAR)

2. USERS (Users includes both staff and students):

Column Datatype
USER_ID VARCHAR2(10 CHAR)
NAME VARCHAR2(50 CHAR)
DESIGNATION VARCHAR2(10 CHAR)

3. ISSUES (Records for books issued):

Column Datatype
Issue_ID Number(10,0)
Book_ID VARCHAR2(10 CHAR)
Book_Title Varchar2(100 CHAR)
Borrower_ID VARCHAR2(10 CHAR)
Borrower_Name Varchar2(100 CHAR)
Borrower_Designation Varchar2(50 CHAR)
Issue_Date DATE
Date_Expiry DATE

4. RETURNS (Records for books returned):

Column DataType
Return_ID Number(10,0)
Book_ID VARCHAR2(10 CHAR)
Borrower_ID VARCHAR2(10 CHAR)
Borrower_Name Varchar2(100 CHAR)
Issue_Date DATE
Deadline_Date DATE
Return_Date DATE
Delay Number(10,0)

5. FINE (Records for fine against books):

Column DataType
Fine_ID Number(10,0)
Book_ID VARCHAR2(10 CHAR)
Book_Title Varchar2(100 CHAR)
Borrower_ID VARCHAR2(10 CHAR)
Borrower_Name Varchar2(100 CHAR)
Delay NUMBER(19,9)
Fine_Amount NUMBER(39,19)

 

Please find below the lucid chart for better explaination:

 

 

 

 

 

 

 

 

 

 

 

 

 

Following are two points which were set as standard while using the delay logic:

For staff members, the maximum delay in return can be of 5 days.

For students,  the maximum delay in return can be of 4 days.

You can change this value by changing the value in below trigger (ISSUE_EXPIRY):

 

 

 

I have provided the SQL files for table creations – BOOKS, USERS, ISSUES, RETURNS and FINE which includes the sample data insertion queries as well.

Apart from this, I have also included the triggers file which will automate the value insertion of columns (marked with green arrow).

Here’s the link for all files: CLICK HERE (Github repository)

If you liked the stuff, please leave positive comment and in case you have any feedback, feel free to share that in comments!

Hospital Management System (Using Database)

Hello Everyone,

Today, I am gonna publish my first database project which is based on hospital management.

Here’s a brief video on it:

It involves the below list of tables (with mentioned structure):

  1. PATIENT:
Column Datatype
PAT_ID VARCHAR2(10 CHAR)
PAT_NAME VARCHAR2(60 CHAR)
PAT_GENDER VARCHAR2(2 CHAR)
PAT_ADDRESS VARCHAR2(100 CHAR)
PAT_NUMBER NUMBER(11,0)
PAT_DOC_CODE VARCHAR2(10 CHAR)

2. PATIENT_DIAGNOSIS:

Column Datatype
DIAG_ID VARCHAR2(10 CHAR)
DIAG_DETAILS VARCHAR2(200 CHAR)
DIAG_REMARKS VARCHAR2(200 CHAR)
DIAG_DATE DATETIME
PAT_ID VARCHAR2(10 CHAR)

3. DOCTOR:

Column Datatype
DOC_CODE VARCHAR2(10 CHAR)
DOC_NAME VARCHAR2(60 CHAR)
DOC_GENDER VARCHAR2(2 CHAR)
DOC_ADDRESS VARCHAR2(200 CHAR)
DOC_DESIGNATION VARCHAR2(30 CHAR)
DOC_NUMBER NUMBER(11,0)

4. BILL:

COLUMN DATATYPE
BILL_NO INTEGER
PAT_ID VARCHAR(10 CHAR)
PAT_NAME VARCHAR2(60 CHAR)
PAT_GENDER VARCHAR2(2 CHAR)
PAT_ADDRESS VARCHAR2(100 CHAR)
DOC_NAME VARCHAR2(160 CHAR)
AMOUNT NUMBER(19,9)

 

Please find below the lucid chart for better explaination:

 

 

 

 

 

 

 

 

 

 

 

 

I have provided sql files for table creations which includes the sample data to be inserted for PATIENT, PATIENT_DIAGNOSIS and DOCTOR.

Apart from this, I have also included the trigger/sequence file which includes the trigger/sequence creation statements along with the sample insertions for fine table in which we only need to insert value for columns BILL_NO and AMOUNT and the remaining details are fetched automatically using triggers from the status tables ( PATIENT, PATIENT_DIAGNOSIS and DOCTOR).

 

Here’s the link for all files: CLICK HERE (Github Repository)

If you liked the stuff, please leave positive comment and in case you have any feedback, feel free to share that in comments!

Starting Basics for running a bash script

First of all you need to open the terminal [Ctrl + Alt + T] OR Konsole [for kubuntu]

Type in “pwd” to get the present working directory.

Then use cd to change the directory location to the location of your script.

 

For example:

 

I have changed the directory to Desktop/test/ because my script test.sh lies inside test folder.

So, as now we are in the directory which contains our script file we need to edit it and write something inside it.

As the beginning program, we start with echo command.

Contents of my test.sh:

 

Now to run this script, we first need to give execute permissions to our script, for that we need to type the following command in terminal:

Now in order to run it, type in terminal:

And you will get the output as:

which was the expected output as echo prints the things you write inside it.

 

More about echo:

Echo can be used in 3 ways:

However, both 3 of them the output will vary!

For example:

I set a variable named test=”Blogging”

Now for all the 3 types:

 

Output for the above statements:

 

As you can see while using single quotes we are unable to print the variable value.

Note:

1 more thing is to be kept in mind while using echo without any quotes that if we want to use special symbols we need to add an escaping character infront of it in order to get it printed without getting error.

For example:

will run without any problem when we use \ as escaping character.

 

Check out the next post to continue learning bash scripting.

Hope you have a good day! 🙂

Program for binary search tree in C

In binary search tree,

The first number that we insert is the root element and every other number that is entered in the binary search tree is compared with the root element.

If the new number is > the root element then it is put in the right sub-tree.

And if new number is < the root element then it is put in the left sub-tree.

 

Program:

 

To perform string concatination & string comparison using operator overloading

Write a C++ program that overloads the + operator and relational operators (suitable) to perform the following operations:

  1. Concatenation of two strings.

2. Comparison of two strings.

 

 

Program to check whether the entered string is a substring of the main string or not.

Write a program that takes two input strings S1 and S2 and finds if S2 is a substring of S1 or not. If S2 is a substring of S1, the program should print the index at S1 at which there is a match. If S2 is not a substring of S1, the program should print -1. If S2 appears in S1 multiple times, print the first index in S1 at which the match occurred.

 

Code:

 

Create a class Rational Number (fractions) with mentioned capabilities

To create a class Rational Number (fractions) with the following capabilities:

  1. a) Create a constructor that prevents a 0 denominator in a fraction, reduces or simplifies fractions that are not in reduced form and avoids negative denominators.
  2. b) Overload the addition, subtraction, multiplication and division operators for this class.

c) Overload the relational and equality operators for this class.

 

 

Code:

 

Program to perform deposit/withdraw and other functions of a bank.

This program will take the input from user and withdraw/deposit the amount as per the liking of the user.

 

Code:

 

 

Program to find the number repeating maximum using classes

This is a program to find the number out of the given list of numbers which repeats the maximum no. of times.

We have predefined the numbers using array.

 

Code:

 

Program to create a saving account using class.

This is a basic c++ program to crate a saving account using class.

 

INPUT – time, rate of interest & balance

OUTPUT – Balance after that time.

Description:

We have to take the balance, rate of interest and time [in months] as input from user and display the balance which user will have after that time interval.

 

Code: