【问题标题】:how to query from Calibre database?如何从 Calibre 数据库中查询?
【发布时间】:2013-02-16 01:52:20
【问题描述】:

如您所知,calibre 有一个名为 metadata.db 的数据库,由 SQLite 制成, 我想从所有具有此列的书籍中查询:

bookId  Title   Date    Size    Rating  Tags    Publisher   PublishedDate   Author  Cover           
------  -----   ----    ----    ------  ----    ---------   -------------   ------  -----

但是,该数据库包含这些表:

Books Table
-----------
Name
id
title
sort
timestamp
pubdate
series_index
author_sort
isbn
lccn
path
flags
uuid
has_cover
last_modified


Authors Table
-------------
Name
id
name
sort
link


Publishers Table
----------------
Name
id
name
sort

它们之间没有关系,我怎样才能得到我的查询?

【问题讨论】:

标签: tsql calibre


【解决方案1】:
SELECT id, title,
               (SELECT name FROM books_authors_link AS bal JOIN authors ON(author = authors.id) WHERE book = books.id) authors,
               (SELECT name FROM publishers WHERE publishers.id IN (SELECT publisher from books_publishers_link WHERE book=books.id)) publisher,
               (SELECT rating FROM ratings WHERE ratings.id IN (SELECT rating from books_ratings_link WHERE book=books.id)) rating,
               (SELECT MAX(uncompressed_size) FROM data WHERE book=books.id) size,
               (SELECT name FROM tags WHERE tags.id IN (SELECT tag from books_tags_link WHERE book=books.id)) tags,
               (SELECT format FROM data WHERE data.book=books.id) formats,
               isbn,
               path,
               pubdate
        FROM books

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-13
    • 1970-01-01
    相关资源
    最近更新 更多