Today I Learned

TIL, 2017-09-10

  • Just reviewing GROUP BY:
SELECT COUNT(CustomerID), Country
FROM Customers
GROUP BY Country;

This means you aggregate the counts of customer ids per country. You end up with

COUNT|COUNTRY
------------

SELECT Shippers.ShipperName, COUNT(Orders.OrderID) AS NumberOfOrders FROM Orders
LEFT JOIN Shippers ON Orders.ShipperID = Shippers.ShipperID
GROUP BY ShipperName;

This is a join in which you just transpose the ShipperName with the ShipperID since you are joining them. So you get the count grouped by ShipperID, then because of the join, you can then get the ShipperName reference.
  • ActiveSupport::Dependencies.autoload_paths to see the autoload_paths.
  • What the heck GraphQL actually is.
  • Fuck some parts of GC have primitive obsessions.

Chaining

class User
  def self.where(hash)
    @where = hash
    self
  end

  def self.sort(field)
    @sort = field
    self
  end
end

Then to trigger, define the kickers, such as all, first, last, that actually assemble and perform the query and return results.

This project is maintained by daryllxd