Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Insert authors
- INSERT INTO authors (id, name) VALUES (1, 'Harper Lee');
- INSERT INTO authors (id, name) VALUES (2, 'George Orwell');
- INSERT INTO authors (id, name) VALUES (3, 'F. Scott Fitzgerald');
- INSERT INTO authors (id, name) VALUES (4, 'J.K. Rowling');
- INSERT INTO authors (id, name) VALUES (5, 'Jane Austen');
- -- Insert books
- INSERT INTO books (title, author_id, price) VALUES ('To Kill a Mockingbird', 1, 15);
- INSERT INTO books (title, author_id, price) VALUES ('Go Set a Watchman', 1, 20);
- INSERT INTO books (title, author_id, price) VALUES ('1984', 2, 20);
- INSERT INTO books (title, author_id, price) VALUES ('Animal Farm', 2, 12);
- INSERT INTO books (title, author_id, price) VALUES ('The Great Gatsby', 3, 25);
- INSERT INTO books (title, author_id, price) VALUES ('Tender Is the Night', 3, 22);
- INSERT INTO books (title, author_id, price) VALUES ('Harry Potter and the Sorcerer''s Stone', 4, 30);
- INSERT INTO books (title, author_id, price) VALUES ('Harry Potter and the Chamber of Secrets', 4, 25);
- INSERT INTO books (title, author_id, price) VALUES ('Pride and Prejudice', 5, 18);
- INSERT INTO books (title, author_id, price) VALUES ('Sense and Sensibility', 5, 16);
- INSERT INTO books (title, author_id, price) VALUES ('Emma', 5, 19);
- INSERT INTO books (title, author_id, price) VALUES ('This Side of Paradise', 3, 18); -- Additional book for F. Scott Fitzgerald
- INSERT INTO books (title, author_id, price) VALUES ('Harry Potter and the Prisoner of Azkaban', 4, 27); -- Additional book for J.K. Rowling
- INSERT INTO categories (category) VALUES ('FANTASY');
- INSERT INTO categories (category) VALUES ('FICTION');
- -- This query populates AUTHOR_BOOK_MAPPING (which is join table) by associating authors with their corresponding books.
- -- Following should be managed by JPA, meaning JPA should create join table, not this script
- --INSERT INTO AUTHOR_BOOK_MAPPING (author_id, book_id)
- --SELECT a.id, b.id
- --FROM authors a
- --JOIN books b ON a.id = b.author_id;
- -- Insert customers POSTPONED
- --INSERT INTO customers (name, email) VALUES
- --('John Doe', '[email protected]'),
- --('Jane Smith', '[email protected]'),
- --('Robert Brown', '[email protected]'),
- --('Emily Davis', '[email protected]'),
- --('Michael Wilson', '[email protected]'),
- --('Sarah Johnson', '[email protected]'),
- --('David Taylor', '[email protected]'),
- --('Laura Martinez', '[email protected]'),
- --('James Anderson', '[email protected]'),
- --('Linda Thompson', '[email protected]');
Advertisement
Add Comment
Please, Sign In to add comment