<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>SQL on Rietta Cybersecurity</title>
    <link>https://rietta.com/tags/sql/</link>
    <description>Recent content in SQL on Rietta Cybersecurity</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>1999-2026 Rietta Inc. All Rights Reserved.</copyright>
    <atom:link href="https://rietta.com/tags/sql/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Best Data Type to store Money in MySQL?</title>
      <link>https://rietta.com/blog/best-data-types-for-currencymoney-in/</link>
      <pubDate>Tue, 04 Jun 2019 13:30:00 -0400</pubDate>
      <guid>https://rietta.com/blog/best-data-types-for-currencymoney-in/</guid>
      <description>&lt;h2 id=&#34;the-short-answer-tldr&#34;&gt;The Short Answer (TL;DR)&lt;/h2&gt;&#xA;&lt;h3 id=&#34;if-acronym-titlegenerally-accepted-accounting-principlesa-hrefhttpsenwikipediaorgwikigenerally_accepted_accounting_principles_united_statesgaapaacronym-compliance-is-required-or-you-need-4-decimalblogmysql-decimal-data-type-places&#34;&gt;If &lt;acronym title=&#34;Generally Accepted Accounting Principles&#34;&gt;&lt;a href=https://en.wikipedia.org/wiki/Generally_Accepted_Accounting_Principles_(United_States)&gt;GAAP&lt;/a&gt;&lt;/acronym&gt; Compliance is required or you need 4 &lt;a href=&#34;https://rietta.com/blog/mysql-decimal-data-type/&#34;&gt;decimal&lt;/a&gt; places:&lt;/h3&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;DECIMAL&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;4&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Which supports a max value of:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;$999,999,999.9999&lt;/code&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;otherwise-if-2-decimal-places-is-enough&#34;&gt;Otherwise, if 2 decimal places is enough:&lt;/h3&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;DECIMAL&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Which supports a max value of:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;$99,999,999,999.99&lt;/code&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Storing currency in PostgreSQL</title>
      <link>https://rietta.com/blog/postgresql-currency-types/</link>
      <pubDate>Mon, 28 Jan 2019 21:00:00 -0500</pubDate>
      <guid>https://rietta.com/blog/postgresql-currency-types/</guid>
      <description>&lt;p&gt;There are different ways we can store currency in PostgreSQL, this blog post will cover the money and numeric types.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Adding a Rake Task for SQL Views to a Rails Project</title>
      <link>https://rietta.com/blog/adding-rake-db-views-for-sql-views-to-a-rails-project/</link>
      <pubDate>Mon, 30 Mar 2015 12:00:00 -0400</pubDate>
      <guid>https://rietta.com/blog/adding-rake-db-views-for-sql-views-to-a-rails-project/</guid>
      <description>&lt;p&gt;I have previously written about &lt;a href=&#34;https://rietta.com/blog/rails-and-sql-views-for-a-report/&#34;&gt;Using Rails and SQL Views for a Report&lt;/a&gt;. A practical consideration when employing SQL views, which create wonderfully fast read-only tables that can be used by ActiveRecord models seamlessly, in a Ruby on Rails project is where to maintain them in a project.&lt;/p&gt;&#xA;&lt;p&gt;One approach is to use migrations, since that&amp;rsquo;s where database stuff normally goes. But a big downside is that this approach is not &lt;acronym title=&#34;Do Not Repeat Yourself - a common Ruby community refrain&#34;&gt;DRY&lt;/acronym&gt; because changing the SQL view requires a new migration that drops the old view and replaces it with the updated version. &lt;em&gt;Simply changing a field in the SQL view requires copying and pasting the entire definition over again&lt;/em&gt;. That&amp;rsquo;s just annoying!&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The second, and in my opinion better approach, is to treat SQL views more like models.&lt;/strong&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to use SQL views to Build Reports with Ruby on Rails</title>
      <link>https://rietta.com/blog/rails-and-sql-views-for-a-report/</link>
      <pubDate>Thu, 28 Nov 2013 10:54:00 +0000</pubDate>
      <guid>https://rietta.com/blog/rails-and-sql-views-for-a-report/</guid>
      <description>SQL views are a powerful capability of a relational database server. This functionality can be easily used to implement important reporting, data mining, and other functionality to a web application built with Ruby on Rails in a manner that may be faster and more concise than an implementation that uses only typical ActiveRecord patterns. The complexity of dealing with the relational data is abstracted away from the Rails application that is a consumer of the data, keeping the model, controllers, and Rails view concisely focused on their appropriate roles.</description>
    </item>
    <item>
      <title>Part I: Introduction to SQL Injection</title>
      <link>https://rietta.com/blog/part-i-introduction-to-sql-injection/</link>
      <pubDate>Sat, 23 Apr 2005 00:00:00 +0000</pubDate>
      <guid>https://rietta.com/blog/part-i-introduction-to-sql-injection/</guid>
      <description>This is Part I of a serialization of a paper I have written on the SQL Injection defenses. As portions of the paper are finished I will post them on this blog. Topics will include a discussion on access control, security models, classification of attacks, and intrusion detection techniques.&#xA;SQL injection is a technique often used to exploit database systems through vulnerable web applications. The techniques allows the attacker to not only steal the entire contents of relational databases but also, in many cases, to make arbitrary changes to the both the database schema and contents.</description>
    </item>
  </channel>
</rss>
