I am having troubles with my SQL query. I have the following movie table:
Name Null? Type
----------------------------------------- -------- ----------------------------
ID_MOVIE NOT NULL NUMBER(4)
TITLE NOT NULL VARCHAR2(30)
GENRE NOT NULL VARCHAR2(30)
YEAR NOT NULL NUMBER(4)
COUNTRY NOT NULL VARCHAR2(30)
DURATION NOT NULL NUMBER(3)
BUDGET NUMBER(10)
INCOMES NUMBER(10)
ID_MOVIE_PREV NUMBER(4)
ID_DIRECTOR
i tried this command: select m.genre, max(m.budget),m.title from movie m group by m.genre,m.title; and got this result:
GENRE MAX(M.BUDGET) TITLE
------------------------------ ------------- ------------------------------
Western 1200000 The Good, the Bad and the Ugly
Horror 806947 Psycho
Crime 7000000 The Godfather: Part III
Action 185000000 The Dark Knight
Drama 26000000 Philadelphia
Drama 13000000 In the Name of the Father
Action 150000000 Batman Begins
Historical 23800000 The Last Emperor
Science-fiction 5800000 Planet of the Apes
Crime 7000000 The Godfather
Action 230000000 The Dark Knight Rises
GENRE MAX(M.BUDGET) TITLE
------------------------------ ------------- ------------------------------
Comedy 28000000 Zoolander
Crime 9000000 Pulp Fiction
Crime 13000000 The Godfather: Part II
War 70000000 Saving Private Ryan
Science-fiction 28000000 Blader Runner
Drama 33000000 Gran Torino
I'd like to have the title of the maximum of each gender. Can anyone tell me on where is my mistake? Thank you by advance!