Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
772 B
3
Indexable
Never
-- Tabel voor boeken
CREATE TABLE Books (
    BookID INT AUTO_INCREMENT PRIMARY KEY,
    Title VARCHAR(255) NOT NULL,
    Author VARCHAR(255) NOT NULL,
    ISBN VARCHAR(20) NOT NULL,
    PublicationYear INT,
    CopiesAvailable INT DEFAULT 1
);

-- Tabel voor leerlingen
CREATE TABLE Students (
    StudentID INT AUTO_INCREMENT PRIMARY KEY,
    FirstName VARCHAR(255) NOT NULL,
    LastName VARCHAR(255) NOT NULL,
    Class VARCHAR(50) NOT NULL
);

-- Tabel voor uitleningen
CREATE TABLE Loans (
    LoanID INT AUTO_INCREMENT PRIMARY KEY,
    BookID INT,
    StudentID INT,
    LoanDate DATE NOT NULL,
    ReturnDate DATE,
    Returned BOOLEAN DEFAULT FALSE,
    FOREIGN KEY (BookID) REFERENCES Books(BookID),
    FOREIGN KEY (StudentID) REFERENCES Students(StudentID)
);
Leave a Comment