Efficient SQL query with multiple selects -


i'm @ university , doing project have queries such as:

select * recent_purchases customer_id in  (  select customer_id     customers name '%john%' )  

i'm not sure if idiomatic way of doing things or if i'm missing "correct" way of doing - feels bit clunky. don't understand joins yet. sorry if stupid question.

use inner join instead of sub-select in where clause:

select *  recent_purchases rp  inner join customers c on c.customer_id = rp.customer_id  c.name '%john%' 

Comments

Popular posts from this blog

.net - Bulk insert via Dapper is slower than inserting rows one-by-one -

shared memory - gstreamer shmsrc and shmsink with h264 data -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -