The difference between COUNT(*) and COUNT(something) in SQL
Use COUNT(something) when you're counting an OUTER JOIN. For example, counting the number of occurences of an association.
Given the following tables:
products
| id | name | price |
|---|
| 57: def create_event(url, event_name, attributes = {}) | |
| => 58: binding.pry | |
| 59: body = { :name => event_name, :data => attributes } | |
| 60: body[:timestamp] = attributes[:timestamp] if valid_timestamp?(attributes[:timestamp]) | |
| 61: verify_response(self.class.post(url, options.merge(:body => body))) | |
| 62: end | |
| [1] pry(#<Customerio::Client>)> attributes | |
| => {:alphabet=>["a", "b", "c"]} |
| 57: def create_event(url, event_name, attributes = {}) | |
| => 58: binding.pry | |
| 59: body = { :name => event_name, :data => attributes } | |
| 60: body[:timestamp] = attributes[:timestamp] if valid_timestamp?(attributes[:timestamp]) | |
| 61: verify_response(self.class.post(url, options.merge(:body => body))) | |
| 62: end | |
| [1] pry(#<Customerio::Client>)> attributes | |
| => {:alphabet=>["a", "b", "c"]} |
| userInputs = [] | |
| konami = [ | |
| 38, 38, # ↑ ↑ | |
| 40, 40, # ↓ ↓ | |
| 37, 39, # ← → | |
| 37, 39, # ← → | |
| 66, 65 # B A | |
| 16, 13 # ⇧ ↩ (shift, enter) | |
| ] | |
The difference between COUNT(*) and COUNT(something) in SQL
Use COUNT(something) when you're counting an OUTER JOIN. For example, counting the number of occurences of an association.
Given the following tables:
products
| id | name | price |
|---|
Collection of articles from around the web about things that are interesting for all of us.
Table of contents:
| class Fabrice | |
| #For Favorite & Watchlist | |
| has_many :event_users | |
| # option 1, tu changes ça : | |
| has_many :events, :through => :event_users | |
| # en : | |
| has_many :user_events, through: :event_users, class_name: 'Event' | |
| # et tu y accèdes via fabrice.user_events |
| require 'guard' | |
| require 'guard/plugin' | |
| module ::Guard | |
| class ReThin < ::Guard::Plugin | |
| def run_all | |
| end | |
| def run_on_changes(paths) | |
| `open http://localhost:5000` |
| export GIT_EDITOR='subl -w' | |
| alias gb='git branch -a -v' # lists all branches and the latest commit for each | |
| alias gs='git status' # less typing | |
| alias gca='git commit -av' # adds all local changes, opens your editor for commit message, and shows diff of commit | |
| alias grm='git ls-files --deleted | xargs git rm' # stages all file deletions at once | |
| alias gcm='git checkout master' # less typing | |
| alias gpr='git pull --rebase' # less typing, more rebasing | |
| alias gspr='git stash; gpr; git stash apply' # useful for keeping local changes across a rebase | |
| alias pull='git pull --rebase' # less typing, more rebasing |
| require "minitest/autorun" | |
| require "capybara" | |
| class TestNthChild < Minitest::Unit::TestCase | |
| def setup_with_html(html) | |
| app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] } | |
| session = Capybara::Session.new(:rack_test, app) | |
| session.visit("/") | |
| return session |
| commit 6778c8e905d774d4dc70724c455e6fcff4c1d3e1 | |
| Merge: e5c64db 3a94dae | |
| Author: Sam Stephenson <[email protected]> | |
| Date: Mon Apr 23 07:45:44 2012 -0700 | |
| Merge pull request #217 from alecchen/master | |
| remove "+=" operator in rbenv-rehash to support bash-3.0 | |
| commit 3a94daeaf848211d93b6e83617623e468555c205 |