-- 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;
Java
Can there be a leak in Direct Memory / native memory in Java?
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?
How to design a system with guaranteed event delivery, transaction coordination, and duplicate protection?
How does garbage collector affect latency in JVM?
What is the contract of equals/hashCode and why is its compliance important?
How does a cached thread pool behave with 100 tasks and 10 already busy threads? Can the number of threads be limited?
How to ensure strict order of a single user's events in Kafka?
What are the possible types of ThreadPoolExecutor/ExecutorService and when to choose which?
How is a new leader for a partition chosen when the old one fails? What is quorum in Kafka?
Why might @Transactional not work in Spring?
Which monitor is used with synchronized?
Can memory leak occur outside heap, for example in stack?
When is JDBC/R2DBC preferable over JPA or MyBatis at the project level?
What are Aware interfaces in Spring?
What are the downsides of orchestration and choreography in Saga? What to do if the orchestrator refuses?
What bottlenecks were in the complaint platform?
Can you see TERMINATED in thread dump and how to use this state in diagnostics?
What thread states exist in JVM?
Did you participate in making global architectural decisions?