Relational Algebra Queries: User, Post, and Comment Database
- Find the uid of the youngest user(s).
π uid (σ age = min(age)(User))
- Find the number of posts made by each user uid.
γ uid, count(pid) (Post)
- Find the username of user who does not make any post or comment.
π username (User - (σ uid = uid (Post) ∪ σ uid = uid (Comment)))
- Find the uid of user who comments all the posts made by username 'Alan Turing'.
π uid (σ username = 'Alan Turing' (User) ÷ σ username = 'Alan Turing' (Comment))
原文地址: https://www.cveoy.top/t/topic/o73f 著作权归作者所有。请勿转载和采集!