question

lido0801 avatar image
lido0801 asked

ask a SQL question

4. Two tables A and B are given: A B X Y 1 1 2 2 3 5 7 How many rows will be in the result set of the following query? SELECT A.X, B.Y FROM A, B WHERE A.X < 3 AND B.Y > = 2 5 Rows 6 Rows 7 Rows 10 Rows 12 Rows
queryhomework
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
KenJ avatar image
KenJ answered
No doubt, by now, you have run the query to see what the actual row count is. This looks like an exam question, so I don't want to come right out and give the answer. Let's see if this gets us close... In order to calculate it without running the query, you need to apply your filters to each set (table), A and B, then multiply the rows in the filtered sets. First look at each set independently. Looking at the filter `A.X < 3`, how many rows will be in filtered set A? How many rows will be in filtered set B if `B.Y > = 2`? The number of rows in the result set will be the product of the rows in the filtered sets: `Filtered Set A * Filtered Set B`
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.