Skip to content

A SQLite database made for learning and practicing SQL. The database aims to model how and what a library keeps track of when lending books.

License

Notifications You must be signed in to change notification settings

diversifyds/library-checkouts-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library Checkouts Database

Background

The Library Checkouts Database is a fictitious and simulated SQLite database made for learning and practicing SQL. The database aims to model how and what a library keeps track of when lending books.

Table Definitions

Below are the data definitions of the tables and columns in the Library Checkouts Database.

users: All users that signed up for a library card with the library

column description data type
id unique id of the user integer
first_name first name of the user text
last_name last name of the user text
birth_date birth date of the user date
phone cell phone of the user text
email email address of the user text
address address where the the user lives text
city city where the user lives text
state state where the user lives text
zip_code zip code where the user lives integer

checkouts: A log of when a user checks out a book from the library

column description data type
id unique id of the book checkout integer
user_id id of the user who checked out a book integer
book_id id of the book that was checked out integer
checkout_date date the book was checked out by the user date
days_checking_out number of days the user will check out the book for integer
due_date date the book is due based off days_checking_out date
return_date date the book was returned by the user date
days_checked_out number of days the book was checked out for integer
returned_with_damage a number to distinguish whether the book was returned with damage
0 = the book was not returned with damage
1 = the book was returned with damage
integer

books: All the books in the library system

column description data type
id unique id of the book integer
title title of the book text
author name of the author text
isbn isbn of the book text
date_published date the book was published date
publisher publisher of the book text
format the format of the book Ex) Hardcover text
pages the number of pages the book has integer

book_genre_link: A table to link books with their respective genre(s)

column description data type
book_id id of the book integer
genre_id id of the genre integer

genres: All the genres in the library system

column description data type
id unique id of the genre integer
name name of the genre text

Prerequisites

Distribution

Packaged Release

In the latest release, download the assets

  • lcdb.db: the SQLite database
  • library-checkouts-erd.png: the entity relationship diagram of the database

Build From Source

Documentation

The database was created using R and Python files.

lcdb_ddl.sql

A SQL script to create the database table definitions.

initiliaze.py

A Python file to execute lcdb-ddl.sql.

users.py

A Python file to create the users table.

books.R

An R file to create the books, genres, and book_genre_link tables.

checkouts.R

An R file to create the checkouts for users and books.

Resources

License


This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License

About

A SQLite database made for learning and practicing SQL. The database aims to model how and what a library keeps track of when lending books.

Topics

Resources

License

Stars

Watchers

Forks