CCCPaste

BOOK-AUTHOR SQL Interview Questions

CREATE TABLE BOOK (
    id INT PRIMARY KEY,
    title VARCHAR(255),
    publication_year INT,
    genre VARCHAR(255),
    ISBN VARCHAR(255)
);

CREATE TABLE AUTHOR (
    id INT PRIMARY KEY,
    name VARCHAR(255),
    birth_date DATE
);

CREATE TABLE BOOK_AUTHOR (
    book_id INT,
    author_id INT,
    PRIMARY KEY (book_id, author_id),
    FOREIGN KEY (book_id) REFERENCES BOOK(id),
    FOREIGN KEY (author_id) REFERENCES AUTHOR(id)
);

/**
TASKS


When was 'Pebble in the sky' published? 

Who was the author of the book titled 'Pebble in the sky' ?

Show how many books each genre has!

Which author has the most books?

What is the title of the book that was republished the most amount of times? 
*/