Database Category

Rietta's database posts cover SQL injection defense, building SQL views in Rails with rake tasks, and using SQL views like Scenic to build complex reports.

02/04/2026

Protect Production SQL Databases from AI/LLM Agentic SQL Query Risks

Prompt injection can talk an LLM agent past a "SELECT only" rule. A read-only replica and lexical SQL validation give deterministic guardrails it can't bypass.

Read More: Protect Production SQL Databases from AI/LLM Agentic SQL Query Risks

06/11/2024

A Journey From QBasic Random Access Files to PostgreSQL

The evolution of data storage from a seasoned developer's perspective: from QBasic's random access files to PostgreSQL transactions and multi-user databases.

Read More: A Journey From QBasic Random Access Files to PostgreSQL

10/24/2019

MySQL Decimal Data Type

The MySQL decimal (A.K.A. numeric) data type stores exact values with a fixed point decimal. The syntax of MySQL's decimal is "DECIMAL(precision, scale)".

Read More: MySQL Decimal Data Type

06/04/2019

Best Data Type to store Money in MySQL?

MySQL has no MONEY type. Use DECIMAL(13,2) for most currency, or DECIMAL(13,4) when GAAP compliance needs four places, and see the max value each can hold.

Read More: Best Data Type to store Money in MySQL?

04/15/2019

How to calculate age in MySQL

While PostgreSQL has a built in age command, MySQL does not. How do we figure out somebody's age in MySQL?

Read More: How to calculate age in MySQL

03/30/2015

Adding a Rake Task for SQL Views to a Rails Project

How to keep SQL views as .sql files in db/sql_views and add a custom 'rake db:views' task to a Rails project, treating database views like ActiveRecord models.

Read More: Adding a Rake Task for SQL Views to a Rails Project

02/11/2014

Reset MySQL Root Password with One Command

One simple command to reset your MySQL root password on Debian/Ubuntu Linux. Don't overthink this one.

Read More: Reset MySQL Root Password with One Command

11/28/2013

How to use SQL views to Build Reports with Ruby on Rails

SQL views help rationalize complex reports. Rails doesn't ship with SQL view support, but the Ruby gem Scenic is very effective at using SQL views in Rails.

Read More: How to use SQL views to Build Reports with Ruby on Rails

04/17/2012

Big data a big deal for SQL Server 2012, users say

Read More: Big data a big deal for SQL Server 2012, users say

12/19/2011

Adding RANDOM alias to RAND in MySQL without Changing Ruby on Rails Code

Read More: Adding RANDOM alias to RAND in MySQL without Changing Ruby on Rails Code