-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInsert_data.sql
More file actions
47 lines (37 loc) · 1.37 KB
/
Insert_data.sql
File metadata and controls
47 lines (37 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
USE Maureen
-- 2. Insert Sample
-- Insert Authors
INSERT INTO Authors (FirstName, LastName, BirthYear)
VALUES ('George', 'Orwell', 1903),
('Jane', 'Austen', 1775), ('J.K.', 'Rowling', 1965),
('Mark', 'Twain', 1835), ('Agatha', 'Christie', 1890);
SELECT * FROM Authors;
-- Insert Categories
INSERT INTO Categories (CategoryName)
VALUES ('Fiction'), ('Mystery'),
('Science Fiction'), ('Biography'),
('Fantasy'); SELECT * FROM Categories;
-- Insert Books
INSERT INTO Books (Title, AuthorID, CategoryID, PublicationYear)
VALUES ('1984', 1, 1, 1949),
('Pride and Prejudice', 2, 1, 1813),
('Harry Potter and the Sorcerer''s Stone', 3, 5, 1997),
('The Adventures of Tom Sawyer', 4, 1, 1876),
('Murder on the Orient Express', 5, 2, 1934);
SELECT * FROM Books;
-- Insert Members
INSERT INTO Members (FirstName, LastName, MembershipDate)
VALUES ('Alice', 'Johnson', '2023-01-15'),
('Bob', 'Smith', '2022-05-20'),
('Charlie', 'Brown', '2021-07-30'),
('David', 'Williams', '2023-09-10'),
('Emma', 'Davis', '2020-11-25');
SELECT * FROM Members;
-- Insert Borrowing Records
INSERT INTO Borrowing (MemberID, BookID, BorrowDate, ReturnDate)
VALUES (1, 1, '2024-02-01', '2024-02-15'),
(2, 3, '2024-02-05', NULL),
(3, 2, '2024-01-20', '2024-02-03'),
(4, 5, '2024-02-10', NULL),
(5, 4, '2024-01-25', '2024-02-12');
SELECT * FROM Borrowing;