Sobes.tech

-- There are data with fields user_id, status, and created_at. -- Write an SQL query that counts successful requests of each user over the last 7 days and sorts the result by count in descending order. -- Successful status - OK CREATE TABLE user_requests ( id BIGSERIAL PRIMARY KEY, user_id BIGINT NOT NULL, status VARCHAR(50) NOT NULL, created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL ); SELECT user_id, COUNT(*) AS successful_count FROM user_requests WHERE status = 'OK' AND created_at >= CURRENT_TIMESTAMP - INTERVAL '7 days' GROUP BY user_id ORDER BY successful_count DESC;

52

Why can a PostgreSQL table grow in size with a small number of rows and how is it related to VACUUM? Can you tune vacuum and how heavy is it?

52

How to design a system with guaranteed event delivery, transaction coordination, and duplicate protection?

50

How does a cached thread pool behave with 100 tasks and 10 already busy threads? Can the number of threads be limited?

50

What are the possible types of ThreadPoolExecutor/ExecutorService and when to choose which?

50

How is a new leader for a partition chosen when the old one fails? What is quorum in Kafka?

50

What are the downsides of orchestration and choreography in Saga? What to do if the orchestrator refuses?

50
/737