Question about how to know how many rows in the result will I get in SQL?
On the exam there will be questions ask me to predit how many rows and coolumns will a statement output.
There will be like 3 join statements in the result table.
Can I assume that the amount of rows is really determined by the first join statement? If the first join statement only output 7 rows then no matter what happen in the next 2 join statements the whole result will just have 7 rows and whatever column it picked.
the statements will be something like this:
LEFT OUTER JOIN cust
ON ord3.custid = cust.custid
INNER JOIN emp3
ON ord3.empid = emp3.empid
- JohnLv 71 month agoFavorite Answer
Number of row return depends on employee join.
select * from [ord3] returns 7 rows
if [ord3].custid does not exist in [cust] table the joined columns would be shown as NULL when join
if [ord3].empid does not exist in [emp3] table the ROW would NOT be shown when join
you have to understand the nature of joins to answer this answer.Source(s): https://rextester.com/CJWJ31090