Database Development

How to optimize selection of pairs from one column of the table (self-join)?

I have a table where one row is – user’s name, place he attended, time when he was there I need to select all pairs of places where any user was (if user was at place a and place b i need row like this: user, place a, place b, time at place a, time […]


How to search for a hash key value in an array of hashes

I have an array of hashes: array = [ {:name => “Bob” , :age => 27 , :place => “A”} , {:name => “John” , :age => 50 , :place => “B”} , {:name => “Alex” , :age => 80 , :place => “C”} ] I want to get the value of :place if :name […]