0% found this document useful (0 votes)
13 views1 page

Lib SQL

Uploaded by

mendoza.crischen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

Lib SQL

Uploaded by

mendoza.crischen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

CREATE TABLE students (

student_no VARCHAR(20) PRIMARY KEY,


student_name VARCHAR(100) NOT NULL,
course VARCHAR(50) NOT NULL,
major VARCHAR(50) NOT NULL,
year_level VARCHAR(20) NOT NULL,
status ENUM('Active', 'Inactive') NOT NULL,
password VARCHAR(255) NOT NULL
);

CREATE TABLE librarians (


id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL
);

CREATE TABLE books (


book_id VARCHAR(20) PRIMARY KEY,
title VARCHAR(255) NOT NULL,
copies INT NOT NULL,
author VARCHAR(100) NOT NULL,
isbn VARCHAR(20) NOT NULL,
category VARCHAR(50) NOT NULL
);

CREATE TABLE borrowing (


id INT AUTO_INCREMENT PRIMARY KEY,
student_no VARCHAR(20) NOT NULL,
book_id VARCHAR(20) NOT NULL,
borrow_date DATE NOT NULL,
due_date DATE NOT NULL,
return_date DATE,
status ENUM('Borrowed', 'Returned', 'Overdue') NOT NULL,
FOREIGN KEY (student_no) REFERENCES students(student_no),
FOREIGN KEY (book_id) REFERENCES books(book_id)
);

You might also like