SQLite
Ruby Config
results_as_hash
From: RubyDoc
A boolean that indicates whether rows in result sets should be returned as hashes or not. By default, rows are returned as arrays.
@db = SQLite3::Database.new <path_to_db>
@db.results_as_hash = true
Examples
Get all URLS updated in the past 10 days
SELECT * FROM Urls WHERE UpdatedAt >= date('now','-10 day');
Update value for rows updated in past 10 days
UPDATE Urls
SET Downloaded = 0
WHERE UpdatedAt >= date('now','-10 day');
GROUP BY
, count()
, and ORDER BY
SELECT *, count(Url)
FROM Urls
GROUP BY HttpCode
ORDER BY count(Url) DESC;