Ruby On Rails Classroom image

Pooja  Negi / Student / 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
Pooja   Negi

Skills    Ruby On Rails

Qualifications :- High School - SSN high school, College/University - HNBGU, College/University - SRHU,
Location :-Ranipokhari,Rishikesh,Uttarakhand,India
Description:- Student
Explore
 

  Students (0)