Skip to content

Commit 13eb790

Browse files
committed
Clearing script
1 parent 25f5f2c commit 13eb790

File tree

1 file changed

+0
-63
lines changed

1 file changed

+0
-63
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,63 +0,0 @@
1-
CREATE TABLE authors (
2-
author_id INT PRIMARY KEY AUTO_INCREMENT,
3-
name VARCHAR(255) NOT NULL,
4-
birth_year INT NOT NULL,
5-
country VARCHAR(255) NOT NULL
6-
);
7-
8-
CREATE TABLE genres (
9-
genre_id INT PRIMARY KEY AUTO_INCREMENT,
10-
name VARCHAR(255) NOT NULL
11-
);
12-
13-
CREATE TABLE books (
14-
book_id INT PRIMARY KEY AUTO_INCREMENT,
15-
title VARCHAR(255) NOT NULL,
16-
author_id INT NOT NULL,
17-
genre_id INT NOT NULL,
18-
publication_year INT NOT NULL,
19-
FOREIGN KEY (author_id) REFERENCES authors(author_id),
20-
FOREIGN KEY (genre_id) REFERENCES genres(genre_id)
21-
);
22-
23-
CREATE TABLE members (
24-
member_id INT PRIMARY KEY AUTO_INCREMENT,
25-
name VARCHAR(255) NOT NULL,
26-
join_date DATE NOT NULL
27-
);
28-
29-
CREATE TABLE loans (
30-
loan_id INT PRIMARY KEY AUTO_INCREMENT,
31-
book_id INT NOT NULL,
32-
member_id INT NOT NULL,
33-
loan_date DATE NOT NULL,
34-
return_date DATE,
35-
FOREIGN KEY (book_id) REFERENCES books(book_id),
36-
FOREIGN KEY (member_id) REFERENCES members(member_id)
37-
);
38-
39-
INSERT INTO authors (name, birth_year, country) VALUES ('F. Scott Fitzgerald', 1896, 'USA');
40-
INSERT INTO authors (name, birth_year, country) VALUES ('Harper Lee', 1926, 'USA');
41-
INSERT INTO authors (name, birth_year, country) VALUES ('George Orwell', 1903, 'UK');
42-
INSERT INTO authors (name, birth_year, country) VALUES ('Jane Austen', 1775, 'UK');
43-
INSERT INTO authors (name, birth_year, country) VALUES ('J.D. Salinger', 1919, 'USA');
44-
45-
INSERT INTO genres (name) VALUES ('Fiction');
46-
INSERT INTO genres (name) VALUES ('Mystery');
47-
INSERT INTO genres (name) VALUES ('Dystopian');
48-
INSERT INTO genres (name) VALUES ('Romance');
49-
INSERT INTO genres (name) VALUES ('Coming of Age');
50-
51-
INSERT INTO books (title, author_id, genre_id, publication_year) VALUES ('The Great Gatsby', 1, 1, 1925);
52-
INSERT INTO books (title, author_id, genre_id, publication_year) VALUES ('To Kill a Mockingbird', 2, 2, 1960);
53-
INSERT INTO books (title, author_id, genre_id, publication_year) VALUES ('1984', 3, 3, 1949);
54-
INSERT INTO books (title, author_id, genre_id, publication_year) VALUES ('Pride and Prejudice', 4, 4, 1813);
55-
INSERT INTO books (title, author_id, genre_id, publication_year) VALUES ('The Catcher in the Rye', 5, 5, 1951);
56-
57-
INSERT INTO members (name, join_date) VALUES ('Alice Smith', '2020-01-01');
58-
INSERT INTO members (name, join_date) VALUES ('Bob Johnson', '2020-01-15');
59-
INSERT INTO members (name, join_date) VALUES ('Charlie Brown', '2020-02-01');
60-
61-
INSERT INTO loans (book_id, member_id, loan_date, return_date) VALUES (1, 1, '2020-01-01', '2020-01-15');
62-
INSERT INTO loans (book_id, member_id, loan_date, return_date) VALUES (2, 2, '2020-01-15', '2020-02-01');
63-
INSERT INTO loans (book_id, member_id, loan_date, return_date) VALUES (3, 3, '2020-02-01', NULL);

0 commit comments

Comments
 (0)