forked from devops0014/python-code-library-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.sql
More file actions
31 lines (26 loc) · 692 Bytes
/
Copy pathdatabase.sql
File metadata and controls
31 lines (26 loc) · 692 Bytes
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
CREATE DATABASE digital_library;
USE digital_library;
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50),
email VARCHAR(100) UNIQUE,
password VARCHAR(100)
);
CREATE TABLE books (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(100),
author VARCHAR(100)
);
CREATE TABLE borrow_records (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT,
book_id INT,
borrow_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Sample books
INSERT INTO books (title, author) VALUES
("Docker Book", "Hemanth"),
("Kubernetes", "Hemanth Reddy"),
("Terraform", "Sai");
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root';
FLUSH PRIVILEGES;