1. Find the uid of the youngest user(s).

π uid (σ age = min(age)(User))

  1. Find the number of posts made by each user uid.

γ uid, count(pid) (Post)

  1. Find the username of user who does not make any post or comment.

π username (User - (σ uid = uid (Post) ∪ σ uid = uid (Comment)))

  1. Find the uid of user who comments all the posts made by username 'Alan Turing'.

π uid (σ username = 'Alan Turing' (User) ÷ σ username = 'Alan Turing' (Comment))

Relational Algebra Queries: User, Post, and Comment Database

原文地址: https://www.cveoy.top/t/topic/o73f 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录