I'm Stuck on this Oracle Query ( Shows no data when run )





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







-2















so I'm trying to answer this query in my oracle database . I'm quite new to SQL.
My Query is to List the full details of the cinemas managed by the employees with the employee number 52 and 55.
I have the test data for this in both the employee and Cinema table which correlates with one another.
However, when I run the statement it just shows the selected column names with no data . And when I run the script it says no rows selected. ( Even though I've commited my changes to my test data in both tables ).



Below is the code I've used.



SELECT Cinema.Cinema_no , Cinema.Cinema_Name , Cinema.Location , Cinema.Managerempno  
FROM CINEMA
INNER JOIN employee ON Cinema.Cinema_no = employee.emp_no
WHERE Cinema.Managerempno = '52' AND Cinema.Managerempno = '55' ;


Please let me know if I've gone completely wrong with this. Or whether I need to change something within it. Thank you










share|improve this question




















  • 2





    WHERE Cinema.Managerempno in ('52', '55')

    – jarlh
    Nov 23 '18 at 14:56











  • Or WHERE Cinema.Managerempno = '52' OR Cinema.Managerempno = '55'.

    – jarlh
    Nov 23 '18 at 14:57






  • 1





    Cinema no = employee no doesn’t look right

    – P.Salmon
    Nov 23 '18 at 15:00











  • Also, your join condition seems a bit illogical. Seems rather strange to join the employee number on the cinema number. Shouldn't it be Cinema.Cinema_no = employee.Cinema_no or something like that? Just a guess, it depends on how your db look of course.

    – NiH
    Nov 23 '18 at 15:00






  • 1





    @Sharad Don't put a "solve' in the title to instruct your problem is now solve. Accept an answer bu checking the green check mark on the left of the most helpfull answer.

    – Anthony Raymond
    Nov 23 '18 at 15:23


















-2















so I'm trying to answer this query in my oracle database . I'm quite new to SQL.
My Query is to List the full details of the cinemas managed by the employees with the employee number 52 and 55.
I have the test data for this in both the employee and Cinema table which correlates with one another.
However, when I run the statement it just shows the selected column names with no data . And when I run the script it says no rows selected. ( Even though I've commited my changes to my test data in both tables ).



Below is the code I've used.



SELECT Cinema.Cinema_no , Cinema.Cinema_Name , Cinema.Location , Cinema.Managerempno  
FROM CINEMA
INNER JOIN employee ON Cinema.Cinema_no = employee.emp_no
WHERE Cinema.Managerempno = '52' AND Cinema.Managerempno = '55' ;


Please let me know if I've gone completely wrong with this. Or whether I need to change something within it. Thank you










share|improve this question




















  • 2





    WHERE Cinema.Managerempno in ('52', '55')

    – jarlh
    Nov 23 '18 at 14:56











  • Or WHERE Cinema.Managerempno = '52' OR Cinema.Managerempno = '55'.

    – jarlh
    Nov 23 '18 at 14:57






  • 1





    Cinema no = employee no doesn’t look right

    – P.Salmon
    Nov 23 '18 at 15:00











  • Also, your join condition seems a bit illogical. Seems rather strange to join the employee number on the cinema number. Shouldn't it be Cinema.Cinema_no = employee.Cinema_no or something like that? Just a guess, it depends on how your db look of course.

    – NiH
    Nov 23 '18 at 15:00






  • 1





    @Sharad Don't put a "solve' in the title to instruct your problem is now solve. Accept an answer bu checking the green check mark on the left of the most helpfull answer.

    – Anthony Raymond
    Nov 23 '18 at 15:23














-2












-2








-2








so I'm trying to answer this query in my oracle database . I'm quite new to SQL.
My Query is to List the full details of the cinemas managed by the employees with the employee number 52 and 55.
I have the test data for this in both the employee and Cinema table which correlates with one another.
However, when I run the statement it just shows the selected column names with no data . And when I run the script it says no rows selected. ( Even though I've commited my changes to my test data in both tables ).



Below is the code I've used.



SELECT Cinema.Cinema_no , Cinema.Cinema_Name , Cinema.Location , Cinema.Managerempno  
FROM CINEMA
INNER JOIN employee ON Cinema.Cinema_no = employee.emp_no
WHERE Cinema.Managerempno = '52' AND Cinema.Managerempno = '55' ;


Please let me know if I've gone completely wrong with this. Or whether I need to change something within it. Thank you










share|improve this question
















so I'm trying to answer this query in my oracle database . I'm quite new to SQL.
My Query is to List the full details of the cinemas managed by the employees with the employee number 52 and 55.
I have the test data for this in both the employee and Cinema table which correlates with one another.
However, when I run the statement it just shows the selected column names with no data . And when I run the script it says no rows selected. ( Even though I've commited my changes to my test data in both tables ).



Below is the code I've used.



SELECT Cinema.Cinema_no , Cinema.Cinema_Name , Cinema.Location , Cinema.Managerempno  
FROM CINEMA
INNER JOIN employee ON Cinema.Cinema_no = employee.emp_no
WHERE Cinema.Managerempno = '52' AND Cinema.Managerempno = '55' ;


Please let me know if I've gone completely wrong with this. Or whether I need to change something within it. Thank you







sql database oracle






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 15:22









Anthony Raymond

4,29732848




4,29732848










asked Nov 23 '18 at 14:55









SharadSharad

74




74








  • 2





    WHERE Cinema.Managerempno in ('52', '55')

    – jarlh
    Nov 23 '18 at 14:56











  • Or WHERE Cinema.Managerempno = '52' OR Cinema.Managerempno = '55'.

    – jarlh
    Nov 23 '18 at 14:57






  • 1





    Cinema no = employee no doesn’t look right

    – P.Salmon
    Nov 23 '18 at 15:00











  • Also, your join condition seems a bit illogical. Seems rather strange to join the employee number on the cinema number. Shouldn't it be Cinema.Cinema_no = employee.Cinema_no or something like that? Just a guess, it depends on how your db look of course.

    – NiH
    Nov 23 '18 at 15:00






  • 1





    @Sharad Don't put a "solve' in the title to instruct your problem is now solve. Accept an answer bu checking the green check mark on the left of the most helpfull answer.

    – Anthony Raymond
    Nov 23 '18 at 15:23














  • 2





    WHERE Cinema.Managerempno in ('52', '55')

    – jarlh
    Nov 23 '18 at 14:56











  • Or WHERE Cinema.Managerempno = '52' OR Cinema.Managerempno = '55'.

    – jarlh
    Nov 23 '18 at 14:57






  • 1





    Cinema no = employee no doesn’t look right

    – P.Salmon
    Nov 23 '18 at 15:00











  • Also, your join condition seems a bit illogical. Seems rather strange to join the employee number on the cinema number. Shouldn't it be Cinema.Cinema_no = employee.Cinema_no or something like that? Just a guess, it depends on how your db look of course.

    – NiH
    Nov 23 '18 at 15:00






  • 1





    @Sharad Don't put a "solve' in the title to instruct your problem is now solve. Accept an answer bu checking the green check mark on the left of the most helpfull answer.

    – Anthony Raymond
    Nov 23 '18 at 15:23








2




2





WHERE Cinema.Managerempno in ('52', '55')

– jarlh
Nov 23 '18 at 14:56





WHERE Cinema.Managerempno in ('52', '55')

– jarlh
Nov 23 '18 at 14:56













Or WHERE Cinema.Managerempno = '52' OR Cinema.Managerempno = '55'.

– jarlh
Nov 23 '18 at 14:57





Or WHERE Cinema.Managerempno = '52' OR Cinema.Managerempno = '55'.

– jarlh
Nov 23 '18 at 14:57




1




1





Cinema no = employee no doesn’t look right

– P.Salmon
Nov 23 '18 at 15:00





Cinema no = employee no doesn’t look right

– P.Salmon
Nov 23 '18 at 15:00













Also, your join condition seems a bit illogical. Seems rather strange to join the employee number on the cinema number. Shouldn't it be Cinema.Cinema_no = employee.Cinema_no or something like that? Just a guess, it depends on how your db look of course.

– NiH
Nov 23 '18 at 15:00





Also, your join condition seems a bit illogical. Seems rather strange to join the employee number on the cinema number. Shouldn't it be Cinema.Cinema_no = employee.Cinema_no or something like that? Just a guess, it depends on how your db look of course.

– NiH
Nov 23 '18 at 15:00




1




1





@Sharad Don't put a "solve' in the title to instruct your problem is now solve. Accept an answer bu checking the green check mark on the left of the most helpfull answer.

– Anthony Raymond
Nov 23 '18 at 15:23





@Sharad Don't put a "solve' in the title to instruct your problem is now solve. Accept an answer bu checking the green check mark on the left of the most helpfull answer.

– Anthony Raymond
Nov 23 '18 at 15:23












1 Answer
1






active

oldest

votes


















1














Use IN:



SELECT c.Cinema_no, c.Cinema_Name, c.Location, c.Managerempno  
FROM CINEMA c
WHERE c.Managerempno IN (52, 55);


Notes:




  • You don't need the JOIN. The employee number is in the Managerempno column.

  • Table aliases make queries easier to write and to read.


  • Empno is -- presumably -- a number. So, don't use single quotes around the constants.






share|improve this answer
























  • Thank you , seems as if I was completely wrong with adding the Inner Join . But I had a vague idea about the where clause. My brain was going crazy for 2 hours thinking why it wasn't working.

    – Sharad
    Nov 23 '18 at 15:08











  • @Sharad . . . You were not "completely wrong" in adding the inner join. You simply made the query a bit more complicated than necessary.

    – Gordon Linoff
    Nov 23 '18 at 15:39












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53448888%2fim-stuck-on-this-oracle-query-shows-no-data-when-run%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Use IN:



SELECT c.Cinema_no, c.Cinema_Name, c.Location, c.Managerempno  
FROM CINEMA c
WHERE c.Managerempno IN (52, 55);


Notes:




  • You don't need the JOIN. The employee number is in the Managerempno column.

  • Table aliases make queries easier to write and to read.


  • Empno is -- presumably -- a number. So, don't use single quotes around the constants.






share|improve this answer
























  • Thank you , seems as if I was completely wrong with adding the Inner Join . But I had a vague idea about the where clause. My brain was going crazy for 2 hours thinking why it wasn't working.

    – Sharad
    Nov 23 '18 at 15:08











  • @Sharad . . . You were not "completely wrong" in adding the inner join. You simply made the query a bit more complicated than necessary.

    – Gordon Linoff
    Nov 23 '18 at 15:39
















1














Use IN:



SELECT c.Cinema_no, c.Cinema_Name, c.Location, c.Managerempno  
FROM CINEMA c
WHERE c.Managerempno IN (52, 55);


Notes:




  • You don't need the JOIN. The employee number is in the Managerempno column.

  • Table aliases make queries easier to write and to read.


  • Empno is -- presumably -- a number. So, don't use single quotes around the constants.






share|improve this answer
























  • Thank you , seems as if I was completely wrong with adding the Inner Join . But I had a vague idea about the where clause. My brain was going crazy for 2 hours thinking why it wasn't working.

    – Sharad
    Nov 23 '18 at 15:08











  • @Sharad . . . You were not "completely wrong" in adding the inner join. You simply made the query a bit more complicated than necessary.

    – Gordon Linoff
    Nov 23 '18 at 15:39














1












1








1







Use IN:



SELECT c.Cinema_no, c.Cinema_Name, c.Location, c.Managerempno  
FROM CINEMA c
WHERE c.Managerempno IN (52, 55);


Notes:




  • You don't need the JOIN. The employee number is in the Managerempno column.

  • Table aliases make queries easier to write and to read.


  • Empno is -- presumably -- a number. So, don't use single quotes around the constants.






share|improve this answer













Use IN:



SELECT c.Cinema_no, c.Cinema_Name, c.Location, c.Managerempno  
FROM CINEMA c
WHERE c.Managerempno IN (52, 55);


Notes:




  • You don't need the JOIN. The employee number is in the Managerempno column.

  • Table aliases make queries easier to write and to read.


  • Empno is -- presumably -- a number. So, don't use single quotes around the constants.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 23 '18 at 14:59









Gordon LinoffGordon Linoff

794k37318422




794k37318422













  • Thank you , seems as if I was completely wrong with adding the Inner Join . But I had a vague idea about the where clause. My brain was going crazy for 2 hours thinking why it wasn't working.

    – Sharad
    Nov 23 '18 at 15:08











  • @Sharad . . . You were not "completely wrong" in adding the inner join. You simply made the query a bit more complicated than necessary.

    – Gordon Linoff
    Nov 23 '18 at 15:39



















  • Thank you , seems as if I was completely wrong with adding the Inner Join . But I had a vague idea about the where clause. My brain was going crazy for 2 hours thinking why it wasn't working.

    – Sharad
    Nov 23 '18 at 15:08











  • @Sharad . . . You were not "completely wrong" in adding the inner join. You simply made the query a bit more complicated than necessary.

    – Gordon Linoff
    Nov 23 '18 at 15:39

















Thank you , seems as if I was completely wrong with adding the Inner Join . But I had a vague idea about the where clause. My brain was going crazy for 2 hours thinking why it wasn't working.

– Sharad
Nov 23 '18 at 15:08





Thank you , seems as if I was completely wrong with adding the Inner Join . But I had a vague idea about the where clause. My brain was going crazy for 2 hours thinking why it wasn't working.

– Sharad
Nov 23 '18 at 15:08













@Sharad . . . You were not "completely wrong" in adding the inner join. You simply made the query a bit more complicated than necessary.

– Gordon Linoff
Nov 23 '18 at 15:39





@Sharad . . . You were not "completely wrong" in adding the inner join. You simply made the query a bit more complicated than necessary.

– Gordon Linoff
Nov 23 '18 at 15:39




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53448888%2fim-stuck-on-this-oracle-query-shows-no-data-when-run%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()