what is a sub query?how will you calculate working days in
a month using sub query?
Answers were Sorted based on User's Feedback
Answer / ankur akash
A query inside a query is a sub query.
The first query depends for its execution based on the
result provided by the execution of inside query. i.e. subquery.
For ex.
Select last_name, salary, job_id
from employees
where salary >(select last_name, salary
from employees
where last_name = 'Higgins');
Here
Select last_name, salary, job_id
from employees
where salary >
talks about the first query depending for its result based
on the execution of the inner query i.e. sub query
(select last_name, salary
from employees
where last_name = 'Higgins');
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / thiyagarajan
A subquery is a select statement within another select
statement.subquery is executed only once and the parent or
outer query will always depends on the value returned by it.
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / mohana sundaram
to extract data from single table or multiple tables
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / p.rajasekar
ex
1)Method
Table tab1 data like Followings
Month date1 Working
Jan 1 0
Jan 1 1
Jan 1 1
Jan 1 0
.
.
.
Then the query should be
select Month,count(Working) from monthname m where working=1
group by Month,working
You will get answer 2;
2 Method
If we store the working days in same column
eg like(1=>Denotes Working,0=>denotes off)
Month Day1
Jan 101010101111
select Month,length(trim(replace(b.Day1,'0','')))
NoofWorkDays from workdays b
Please test it.Let me know the feed back
Is This Answer Correct ? | 1 Yes | 2 No |
How does postgresql compare to oracle/db2/ms sql server/informix?
What does truncate mean in sql?
What type of database is sql?
write a query to remove null following table are id name 101 dinesh null jyothi null bharathi 102 suresh null shilpha 103 prakesh null suma i want the output format like id name 101 dinesh 102 suresh 103 prakesh
What is natural join in sql?
what is the difference between to_char and to_date functions?
What is scope of pl sql developer in future?
How to trace the errors in pl/sql block code?
What are nested triggers ?
6 Answers Amazon, Appeal Soft, IBM, Infosys, TCS,
Mention what does plv msg allows you to do?
Why cannot I use bind variables in ddl/scl statements in dynamic sql?
Explain what is a column in a table?