-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibrary_Management_System.sql
More file actions
138 lines (111 loc) · 5.2 KB
/
Copy pathLibrary_Management_System.sql
File metadata and controls
138 lines (111 loc) · 5.2 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
CREATE DATABASE Library_Management_System
CREATE TABLE publisher (
publisher_PublisherName VARCHAR(100) PRIMARY KEY NOT NULL,
publisher_PublisherAddress VARCHAR(200) NOT NULL,
publisher_PublisherPhone_No VARCHAR(50) NOT NULL);
CREATE TABLE books (
book_BookID INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
book_Title VARCHAR(100) NOT NULL,
book_PublisherName VARCHAR(100) NOT NULL);
CREATE TABLE library_branch (
library_branch_BranchID INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
library_branch_BranchName VARCHAR(100) NOT NULL,
library_branch_BranchAddress VARCHAR(200) NOT NULL);
SELECT * FROM library_branch
CREATE TABLE borrower (
borrower_CardNo INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
borrower_BorrowerName VARCHAR(100) NOT NULL,
borrower_BorrowerAddress VARCHAR(200) NOT NULL,
borrower_BorrowerPhone VARCHAR(50) NOT NULL
);
SELECT * FROM borrower
CREATE TABLE book_loans (
book_loans_LoansID INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
book_loans_BookID INT NOT NULL ,
book_loans_BranchID INT NOT NULL,
book_loans_CardNo INT NOT NULL ,
book_loans_DateOut VARCHAR(50) NOT NULL,
book_loans_DueDate VARCHAR(50) NOT NULL
);
SELECT * FROM book_loans
CREATE TABLE book_copies (
book_copies_CopiesID INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
book_copies_BookID INT NOT NULL,
book_copies_BranchID INT NOT NULL,
book_copies_No_Of_Copies INT NOT NULL
);
SELECT * FROM book_copies
CREATE TABLE book_authors (
book_authors_AuthorID INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
book_authors_BookID INT NOT NULL,
book_authors_AuthorName VARCHAR(50) NOT NULL
);
SELECT * FROM book_authors
INSERT INTO publisher
(publisher_PublisherName, publisher_PublisherAddress, publisher_PublisherPhone_No)
VALUES
('DAW Books','375 Hudson Street, New York, NY 10014','212-366-2000'),
('Viking','375 Hudson Street, New York, NY 10014','212-366-2000'),
('Signet Books','375 Hudson Street, New York, NY 10014','212-366-2000'),
('Chilton Books','Not Available','Not Available'),
('George Allen & Unwin','83 Alexander Ln, Crows Nest NSW 2065, Australia','+61-2-8425-0100'),
('Alfred A. Knopf','The Knopf Doubleday Group Domestic Rights, 1745 Broadway, New York, NY 10019','212-940-7390'),
('Bloomsbury','Bloomsbury Publishing Inc., 1385 Broadway, 5th Floor, New York, NY 10018','212-419-5300'),
('Shinchosa','Oga Bldg. 8, 2-5-4 Sarugaku-cho, Chiyoda-ku, Tokyo 101-0064 Japan','+81-3-5577-6507'),
('Harper and Row','HarperCollins Publishers, 195 Broadway, New York, NY 10007','212-207-7000'),
('Pan Books','175 Fifth Avenue, New York, NY 10010','646-307-5745'),
('Chalto & Windus','375 Hudson Street, New York, NY 10014','212-366-2000'),
('Harcourt Brace Jovanovich','3 Park Ave, New York, NY 10016','212-420-5800'),
('W.W. Norton',' W. W. Norton & Company, Inc., 500 Fifth Avenue, New York, New York 10110','212-354-5500'),
('Scholastic','557 Broadway, New York, NY 10012','800-724-6527'),
('Bantam','375 Hudson Street, New York, NY 10014','212-366-2000'),
('Picador USA','175 Fifth Avenue, New York, NY 10010','646-307-5745')
;
SELECT * FROM publisher
INSERT INTO books
(book_Title, book_PublisherName)
VALUES
('The Name of the Wind', 'DAW Books'),
('It', 'Viking'),
('The Green Mile', 'Signet Books'),
('Dune', 'Chilton Books'),
('The Hobbit', 'George Allen & Unwin'),
('Eragon', 'Alfred A. Knopf'),
('A Wise Mans Fear', 'DAW Books'),
('Harry Potter and the Philosophers Stone', 'Bloomsbury'),
('Hard Boiled Wonderland and The End of the World', 'Shinchosa'),
('The Giving Tree', 'Harper and Row'),
('The Hitchhikers Guide to the Galaxy', 'Pan Books'),
('Brave New World', 'Chalto & Windus'),
('The Princess Bride', 'Harcourt Brace Jovanovich'),
('Fight Club', 'W.W. Norton'),
('Holes', 'Scholastic'),
('Harry Potter and the Chamber of Secrets', 'Bloomsbury'),
('Harry Potter and the Prisoner of Azkaban', 'Bloomsbury'),
('The Fellowship of the Ring', 'George Allen & Unwin'),
('A Game of Thrones', 'Bantam'),
('The Lost Tribe', 'Picador USA');
SELECT * FROM books WHERE book_PublisherName = 'Bantam'
INSERT INTO library_branch
(library_branch_BranchName, library_branch_BranchAddress)
VALUES
('Sharpstown','32 Corner Road, New York, NY 10012'),
('Newland','491 3rd Street, New York, NY 10014'),
('Saline','40 State Street, Saline, MI 48176'),
('Ann Arbor','101 South University, Ann Arbor, MI 48104')
UPDATE library_branch
SET library_branch_BranchName = 'Central'
WHERE library_branch_BranchID = 2;
select * from library_branch
INSERT INTO borrower
(borrower_BorrowerName, borrower_BorrowerAddress, borrower_BorrowerPhone)
VALUES
('Joe Smith','1321 4th Street, New York, NY 10014','212-312-1234'),
('Jane Smith','1321 4th Street, New York, NY 10014','212-931-4124'),
('Tom Li','981 Main Street, Ann Arbor, MI 48104','734-902-7455'),
('Angela Thompson','2212 Green Avenue, Ann Arbor, MI 48104','313-591-2122'),
('Harry Emnace','121 Park Drive, Ann Arbor, MI 48104','412-512-5522'),
('Tom Haverford','23 75th Street, New York, NY 10014','212-631-3418'),
('Haley Jackson','231 52nd Avenue New York, NY 10014','212-419-9935'),
('Michael Horford','653 Glen Avenue, Ann Arbor, MI 48104','734-998-1513');
SELECT * FROM borrower