in Databases
256 views
1 vote
1 vote
Consider the following table.

Create table TEST (

one integer,

two integer,

primary key(one, two),

check (one between 1 and 10),

check (two between 1 and 5)

);

How many tuples at most can this table contain?
in Databases
by
256 views

2 Comments

@LRU

 

As one is primary key and it varies from 1 to 10 , So using one at most 10 tuples can be there.

When we take two into consideration it varies from 1 to 5 and is unique, which implies it can be NULL.

Hence the number of tuples will be 10, with two being NULL in five of them...

 

### https://gateoverflow.in/33100/Ugcnet-dec2015-iii-59

 

0
0
One and two both together are forming the Primary Key so as per me 50 tuples at most this table can contain.
0
0

2 Answers

4 votes
4 votes
Best answer

We will observe one of the cases considering $m$ varies from 1 to 4 and $n$ varies 1 to 2.

Now our primary key is {$m$,$n$} i.e, together they must be unique.

So, the different tuples we get are (1,1), (2,2), (3,1), (4,2), (1,2), (2,1), (3,2), (4,1) .

Here they are all unique, So, for $m$=4 and $n$=2, we get at most 8 tuples.


The answer to the question will be 10*5 = 50.

selected by
0 votes
0 votes

According to me the answer should be 36, as both { one, two} form PK. Also the values of one is between 1 and 10 i.e. inclusive of 1 and exclusive of 10 hence total of 9 values . Similarly goes for two. Thus 9*4= 36