Home » SQL & PL/SQL » SQL & PL/SQL » is it the right query ! (10.2.0.1.0)
is it the right query ! [message #347689] Fri, 12 September 2008 17:37 Go to next message
ukdas
Messages: 32
Registered: September 2008
Location: London
Member

hi, i have written a syntax to develop a query which i am not sure giving the right result or not. the query could be like to find the missions which demand the highest information security level.

the following tables i have:
agents
locations
missions_agents
missions
mission_types
information
info_access
  • Attachment: mission.sql
    (Size: 0.42KB, Downloaded 118 times)
Re: is it the right query ! [message #347692 is a reply to message #347689] Fri, 12 September 2008 20:52 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & FOLLOW the Posting Guidelines as stated in URL above

>i am not sure giving the right result or not.
How are we to know what are the correct result set?
Re: is it the right query ! [message #347703 is a reply to message #347689] Sat, 13 September 2008 00:29 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
When a query has just a couple of lines, post it (formatted) in the post, some of us can't or don't want to download files.

Regards
Michel
Re: is it the right query ! [message #348117 is a reply to message #347689] Mon, 15 September 2008 12:46 Go to previous messageGo to next message
ukdas
Messages: 32
Registered: September 2008
Location: London
Member

the syntax for the query that i stated earlier is like:

1select
2 mt.description TYPES_OF_MISSIONS
3from
4 mission_types mt
5 inner join missions m on
6 m.mission_type_id=mt.mission_type_id
7 inner join missions_agents ma on
8 ma.mission_id=m.mission_id
9 inner join agents a on
10 a.agent_id=ma.agent_id
11where
12 a.security_level IN
13 (
14 select
15 max(a.security_level)
16 from
17 agents a
18 )
19order by
20 m.mission_id
21;

i don't know whether it is giving the right output for the query or not. i just want to make the verification or find any mistake that i am not apparently being able to identify.
Re: is it the right query ! [message #348118 is a reply to message #348117] Mon, 15 September 2008 12:51 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel
Re: is it the right query ! [message #348119 is a reply to message #347689] Mon, 15 September 2008 12:52 Go to previous message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
You have the tables. We don't
You have the data. We don't
You have the requirements. We don't.
You have the actual results. We don't.

How are we to know what are the correct result set?

Just compare the requirements to what is returned & decide OK or not.

Why do you have more than 1 table in FROM clause, when data is FROM a single table?

Eliminate the other tables out of the FROM clause.

[Updated on: Mon, 15 September 2008 15:03] by Moderator

Report message to a moderator

Previous Topic: Row to Column
Next Topic: different results
Goto Forum:
  


Current Time: Sun Dec 04 10:43:16 CST 2016

Total time taken to generate the page: 0.07486 seconds