Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.34 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Cheap way of modeling friend relationships
  2. class User {
  3.     String username;
  4.     Text friends; // "joe,mary,frank,pete"
  5. }
  6.        
  7. class User {
  8.     String username;
  9.     List<String> friends;
  10.       // or //
  11.     Set<String> friends;
  12. }
  13.        
  14. SELECT COUNT FROM User WHERE
  15.     (username = "me" && friends = "bob") &&
  16.     (username = "bob" && friends = "me")