Giter Site home page Giter Site logo

database_assignment_2's Introduction

Database_assignment_2

Overview

The Bookstore Management System is a Java application developed in IntelliJ IDEA that facilitates the management of books, authors, customers, and orders. It provides a set of functionalities to interact with a PostgreSQL database, including CRUD operations, transaction handling, and metadata access.

Database Schema

The database consists of four tables: Author, Book, Customer, and OrderBook. The relationships are Many-to-One between Author and Book, Book and OrderBook, and Customer and OrderBook. For a visual representation of the database schema, refer to the ER Diagram.

F# unctions

Connect Function

This function establishes a connection to a PostgreSQL database. It takes the database name, username, and password as parameters and returns a Connection object if the connection is successful.

Insert_Into_Book Function

Inserts a new record into the Book table with the provided information. Uses SQL INSERT INTO statement to add a new row to the table.

Read_Book_Table Function

Reads and prints all records from the Book table. Retrieves data using an SQL SELECT * FROM Book query and prints details to the console.

Update_Book_Table Function

Updates the quantity of a book in the Book table based on book ID. Uses SQL UPDATE statement to modify the quantity of a specified book.

Delete_Row_From_Book Function

Deletes a row from the Book table based on the provided book ID. Uses SQL DELETE FROM statement to remove the specified book.

INSERT_INTO_Book Function

Inserts a new record into the ORDERBOOK table, representing a customer order. Executes an SQL INSERT INTO statement to add a new order.

Check_Number_Of_Books Function

Checks if there are enough books in stock based on the requested quantity. Returns the remaining quantity if there are enough books, otherwise returns -1.

Order_Book Function

Initiates the process of ordering a book by checking availability and updating the tables. Calls Check_Number_Of_Books to verify stock, then updates ORDERBOOK and Book tables accordingly.

Table_Detail Function

Prints details about tables in the connected database, including table names and column details.

Column_Detail Function

Prints details about columns in each table, including column names and data types.

Primary_Key, Foreign_Key Functions

Print details about primary keys and foreign keys in the connected database, respectively.

Usage

Clone the repository. Open the project in IntelliJ IDEA. Update the database connection details in the main class. Run the main class to execute various functions.

database_assignment_2's People

Contributors

jalasgarli avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.