database practice in SQL and Ruby