Skip to content

Instantly share code, notes, and snippets.

@explicite
Last active February 28, 2022 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save explicite/e024aa2393840883ad0409e455aa9f32 to your computer and use it in GitHub Desktop.
Save explicite/e024aa2393840883ad0409e455aa9f32 to your computer and use it in GitHub Desktop.
Question

Library

You where asked to help with the library system. It's simple SQL db with three tables User, Book and Borrow. Borrow table is journal. For each change in library - borrowing - you will have new row. E.g when you borrow a book, you will have new row in Borrow table with current timestamp. When you will return the book, you will have new row in Borrow table with current timestamp.

Below you can find schema for them:

User

id name
1 John Deer

Book

id title author publish_year
1 First Book Voodo Man 2021

Borrow

user_id book_id borrowed timestamp
1 2 true 2020-03-17 00:00:00.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment