Skip to content
The Chat Archive
amazon.nova-pro-v1:0 LMArena Human Preference 140K

How do I issue SQL query in SQLite3 to count rows in all tables? I want the result to be…

  1. User

    How do I issue SQL query in SQLite3 to count rows in all tables? I want the result to be in one output, sorted by descending number of rows. Do not output too much surrounding text, I'm only interested in queries.

  2. Assistant
    WITH row_counts AS (
      SELECT
        tbl_name AS table_name,
        (SELECT COUNT(*) FROM tbl_name) AS count
      FROM sqlite_master
      WHERE type = 'table'
    )
    SELECT table_name, count
    FROM row_counts
    ORDER BY count DESC;
    

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.