Junior — Senior
Retrieving all records from users with more than 500 followers
livecode
Task condition
It is necessary to display all records (posts) created by users whose follower count exceeds 500. There are three tables: profile, post, and subscription_count.
CREATE TABLE profile(
id BIGSERIAL PRIMARY KEY,
nickname VARCHAR,
registered_at TIMESTAMP
);
CREATE TABLE post
(
id BIGSERIAL PRIMARY KEY,
owner_id BIGINT REFERENCES profile (id),
body TEXT,
inserted_at TIMESTAMP,
likes_count INT -- number of likes
);
CREATE TABLE subscription_count
(
profile_id BIGINT REFERENCES profile (id) UNIQUE,
followers_count INT, -- number of followers
following_count INT -- number of followings
);