MAX function as shown below:
SELECT MAX(value) FROM TYou can also do it without the MAX function as follows:
SELECT T.* FROM T MINUS SELECT T.* FROM T, T as T2 WHERE T.value<T2.valueor:
SELECT T.* FROM T LEFT JOIN T as T2 ON T.value<T2.value WHERE T2.value IS NULLRelational Algebra:
Using Relational Algebra (RA) syntax, this would be:
\project_{value}(T)
\diff
\project_{value} (
\select_{value < value2}(
\project_{value}(T)
\cross
\rename_{value2}(\project_{value}(T))
)
)
where:
\crossis the relational cross-product operator\diffis the relational diff operator\project_{attr_list}is the relational projection operator\rename_{new_attr_name_list}is the relational renaming operator\select_{cond}is the relational selection operator
Wow very helpful thanks!
ReplyDelete