Как написать SQL-запрос для выборки авторов из базы данных?

  • 17 августа 2023 г. 22:25
Ответы на вопрос 5
SELECT Author.Authorld, Author.Name
FROM Author
LEFT JOIN Book ON Author.Authorld = Book.Authorld
WHERE Book.Authorld IS NULL OR Book.PublishDateTime < DATEADD(year, -2, GETDATE());
SELECT * FROM Author WHERE Authorld NOT IN (SELECT Authorld FROM Book WHERE PublishDateTime > CURDATE() - INTERVAL 2 YEAR)
SELECT * FROM Author WHERE NOT EXISTS (SELECT NULL FROM Book WHERE Author.Authorld = Book.Authorld AND Book.PublishDateTime >= CURRENT_DATE - INTERVAL 2 YEAR)
SELECT *
FROM Author
WHERE Authorld is not present in (
    SELECT Authorld
    FROM Book
    WHERE PublishDateTime is more recent than 2 years ago
  )
SELECT *
FROM Author
WHERE there is no existence of (
    SELECT NULL
    FROM Book
    WHERE Author.Authorld matches Book.Authorld
      AND Book.PublishDateTime is greater than or equal to 2 years ago
    )
Похожие вопросы