What is subquery ?
Answers were Sorted based on User's Feedback
Answer / s
Subquery is a SELECT statement used within a WHERE clause
or having CLAUSE of an SQL statment.
Is This Answer Correct ? | 26 Yes | 5 No |
Answer / xx
A query embedded inside another (parent) SQL statement,
returning rows used by the parent.
Is This Answer Correct ? | 15 Yes | 6 No |
Answer / v.chellappa
Usally subquery is executed first then result return to the
main query.
Based on the returned value the main querey is executed
Is This Answer Correct ? | 7 Yes | 1 No |
Answer / kinjal patel
subquery is a slect statement that is embaded in clause of
another sql statement ,called the parent statement.
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / pooja intwala
A subquery is a SELECT statement within another SQL statement. The SQL statement can be SELECT, WHERE clause, FROM clause, JOIN, INSERT, UPDATE, DELETE, SET, DO, or another subquery.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / navdeep gill
subquery can be define sa a select query that erturns
single or multiple values
Is This Answer Correct ? | 3 Yes | 5 No |
What is a correlated sub query?
Is db2 a mainframe database?
When is the access path determined for dynamic SQL?
quary for 1> fetch last record 2> fetch in reverse order 3> fetch last 5 row 4> fetch second last record (their is no primary key) i think concept of count can be use for this in 4th
Can you tell me how can you find out the # of rows updated after an update statement?
What are db2 tables?
what are the frequent DB2 abends did you encounter in your programs ?? What are different SQL abends ??
can any one expalin check point with an example?
How to resolve -805 error in DB2?
SET is the ANSI standard for variable assignment, SELECT is not. SET can only assign one variable at a time, SELECT can make multiple assignments at once. If assigning from a query, SET can only assign a scalar value. If the query returns multiple values/rows then SET will raise an error. SELECT will assign one of the values to the variable and hide the fact that multiple values were returned (so you'd likely never know why something was going wrong elsewhere - have fun troubleshooting that one) When assigning from a query if there is no value returned then SET will assign NULL, where SELECT will not make the assignment at all (so the variable will not be changed from it's previous value) As far as speed differences - there are no direct differences between SET and SELECT. However SELECT's ability to make multiple assignments in one shot does give it a slight speed advantage over SET.
What are the various locks available?
Is schema the same as database?