Created
April 17, 2024 14:31
-
-
Save utkarshsingh99/e9a8c0a5c8fb8d5fc5973370c0384413 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE authors ( | |
author_id INT PRIMARY KEY, | |
name VARCHAR(255) NOT NULL, | |
birth_date DATE | |
); | |
CREATE TABLE books ( | |
book_id INT PRIMARY KEY, | |
title VARCHAR(255) NOT NULL, | |
publication_year INT, | |
author_id INT, | |
FOREIGN KEY (author_id) REFERENCES authors(author_id) | |
); | |
CREATE TABLE patrons ( | |
patron_id INT PRIMARY KEY, | |
name VARCHAR(255) NOT NULL, | |
email VARCHAR(255) | |
); | |
CREATE TABLE book_checkouts ( | |
checkout_id INT PRIMARY KEY, | |
book_id INT, | |
patron_id INT, | |
checkout_date DATE, | |
return_date DATE, | |
FOREIGN KEY (book_id) REFERENCES books(book_id), | |
FOREIGN KEY (patron_id) REFERENCES patrons(patron_id) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment