Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9200195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:42:41+00:00 2026-06-17T22:42:41+00:00

I have been trying to solve this for a while now, any help would

  • 0

I have been trying to solve this for a while now, any help would be greatly appreciated.

I have tables:

distributor(distributor_name, distributor_id)
distributed(price, movie_id, distributor_id)
movie(title, movie_id)

Each distributor has multiple records for movies at different prices.

I am trying to select the minimum price for a particular movie and from what distributor

so far I have tried:

select min(Price), Distributor from
(select m.distributor_name as Distributor, d.price from 
distributors m, distributed d, movies mo
where
mo.title = 'Movie Name' and mo.movie_id = d.movie_id and d.distributor_id = m.distributor_id)
group by Distributor;

Which returns the minimum price for each distributor.

If I run:

select min(Price)
(select m.distributor_name as Distributor, d.price from 
distributors m, distributed d, movies mo
where
mo.title = 'Movie Name' and mo.movie_id = d.movie_id and d.distributor_id = m.distributor_id);

It gives just the lowest price of that particular movie.

How can I get the name of the distributor for the lowest price?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:42:42+00:00Added an answer on June 17, 2026 at 10:42 pm

    Depending on your version of Oracle, you can use row_number():

    select price, distributor
    from
    (
      select d.price, 
        m.distributor_name as Distributor,
        row_number() over(order by d.price) rn
      from distributors m
      inner join distributed d
        on d.distributor_id = m.distributor_id
      inner join movies mo 
        on mo.movie_id = d.movie_id 
      where mo.title = 'Movie Name' 
    ) src
    where rn = 1;
    

    See SQL Fiddle with Demo

    If you wanted to expand on this and get the lowest price for any movie, then you could partition the data by movie title:

    select price, distributor
    from
    (
      select d.price, 
        m.distributor_name as Distributor,
        row_number() over(partition by mo.title order by d.price) rn
      from distributors m
      inner join distributed d
        on d.distributor_id = m.distributor_id
      inner join movies mo 
        on mo.movie_id = d.movie_id 
    ) src
    where rn = 1;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to solve this for a while now. I have an
I have been trying to solve this problem for a while now. I have
I have been trying to solve this problem for a while now and I
I have been trying to solve this one for a while now and have
I have been trying to solve this problem for a while, but couldn't with
I’ve been trying to solve this problem for a while now to no avail.
I've been trying to solve this problem for a while now, and I'm at
I've been trying to solve this problem for a while now and I just
I have been trying to solve this problem for a while, could not find
I've been trying to logically think about this for a while now and usually

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.