query

0 views
Skip to first unread message

Srinivas Golyalla

unread,
Jun 5, 2010, 4:41:39 AM6/5/10
to Ruby on Rails: Talk
‘Teacher’ is a table in a database. Based on that information,
explain what the following query is searching for in the table:
Teacher.find(:all, :condition => { :grade => 9..12})

Sijo k g

unread,
Jun 5, 2010, 1:27:15 PM6/5/10
to rubyonra...@googlegroups.com
> Teacher.find(:all, :condition => { :grade => 9..12})

This means getting all records from teacher table teachers where
column grade has value between 9 & 12.

select * from teachers where grade between 9 and 12


Sijo

--
Posted via http://www.ruby-forum.com/.

Srinivas Golyalla

unread,
Jun 5, 2010, 3:29:43 PM6/5/10
to Ruby on Rails: Talk
Thank You Sijo

Marnen Laibow-Koser

unread,
Jun 6, 2010, 1:35:20 AM6/6/10
to rubyonra...@googlegroups.com
Srinivas Golyalla wrote:
> �Teacher� is a table in a database. Based on that information,

> explain what the following query is searching for in the table:
> Teacher.find(:all, :condition => { :grade => 9..12})

Do your own homework.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

Sanjay Sarachandrakumaran

unread,
Jun 5, 2010, 7:22:43 PM6/5/10
to rubyonra...@googlegroups.com
It would be a better practice to include all column names in the Select instead of *



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.




--
Sanjay Sarachandrakumaran

Follow me
http://www.twitter.com/ssarachandra
http://www.facebook.com/ssarachandra

Ar Chron

unread,
Jun 6, 2010, 1:44:56 PM6/6/10
to rubyonra...@googlegroups.com
Srinivas Golyalla wrote:
> �Teacher� is a table in a database. Based on that information,

> explain what the following query is searching for in the table:
> Teacher.find(:all, :condition => { :grade => 9..12})

this query returns an uneducated student named srinivas

Marnen Laibow-Koser

unread,
Jun 6, 2010, 5:52:26 PM6/6/10
to rubyonra...@googlegroups.com
Ar Chron wrote:
> Srinivas Golyalla wrote:
>> �Teacher� is a table in a database. Based on that information,
>> explain what the following query is searching for in the table:
>> Teacher.find(:all, :condition => { :grade => 9..12})
>
> this query returns an uneducated student named srinivas

Well said!

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

Reply all
Reply to author
Forward
0 new messages