Ruby On Rails Classroom image

Anil  Bist / Professional / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3|Last
Lessons:-Subselects

The question mark syntax is fine, but when we want the same variable inserted in more than one place the second syntax is more convenient.

        The above discussion mentions that we will be adding a second occurrence of user_id in the SQL query. In particular, we can replace the Ruby code

 

This code contains a SQL subselect, and internally the entire select for user 1 would look something like this:

 

This subselect arranges for all the set logic to be pushed into the database, which is more efficient.13

     With this foundation, we are ready for an efficient feed implementation, as seen in Listing 11.45. Note that, because it is now raw SQL, followed_user_ids is interpolated, not escaped. (It actually works either way, but logically it makes more sense to interpolate in this context.)

 
 
 
image
Anil  Bist

Skills    Ruby On Rails

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-

I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore

 

  Students (0)