Guru on Rails

if you don’t sacrifice for your dream then your dream becomes your sacrifice.
Will Nguyen

SQL


Sun 24 Feb 2019

SQL

1. Searching the products which have duplicated names. Product.select("name, count(*) as num").group(:name).having("num > 1") SELECT name, COUNT(*) FROM products GROUP BY name HAVING COUNT(*) &g...


Thu 18 Jul 2019

Best Practices Performance SQL

If we work on a complex system, queries are pretty complex with a ton of subqueries, we would encounter the problem of optimization of query. In order to achieve a goal, we have many ways to do. So...