Consider a database with three relation instances shown below. The primary keys for the Drivers and Cars relation are did and cid respectively and the records are stored in ascending order of these primary keys as given in the tables. No indexing is available in the database.
did22293132586471748595dnameKarthikeyanSalmanBorisAmoldtSchumacherSachinSennaSachinRahulRalphrating718810710933age25335525353516352553D: Drivers relationdid22222222313131646474Cid101102103104102103104101102103day10−10−0610−10−0608−10−0607−10−0610−11−1606−11−1612−11−1605−09−0608−09−0608−09−06R: Reserves relation
Cid101102103104CnameRenaultRenaultFerrariJaguarcolourblueredgreenredC: Cars relation
select D.dname
from Drivers D
where D.did in (
select R.did
from Cars C, Reserves R
where R.cid = C.cid and C.colour = 'red'
intersect
select R.did
from Cars C, Reserves R
where R.cid = C.cid and C.colour = 'green'
)
Let n be the number of comparisons performed when the above SQL query is optimally executed. If linear search is used to locate a tuple in a relation using primary key, then n lies in the range: