Sobes.tech

Data Analyst

Two prisoners in different cells flip coins and, seeing only their own coin result, must guess the result of their neighbor's coin. If at least one guesses correctly, both are released; if both are wrong, they are killed. What strategy should they choose to survive with 100% certainty?

Middle
173

Propose an algorithm that, based on call traffic data and subscriber geolocation, determines every 15 minutes whether two subscribers live together.

Middle
134

There are 3 and 5-liter vessels and an unlimited water source. How to measure exactly 4 liters?

Middle
134

What symbol should be specified after SELECT to select all columns?

Middle
132

Do you know mathematical statistics and have you applied A/B testing in practice? What types of averages do you know?

Middle
128

How to leave only categories with a total revenue of more than 100 rubles?

Middle
128

Have you worked with Git?

Middle
127

Presented are tables A and B: select * from A +----+-----+ |id |val | +----+-----+ |1 |A | |2 |B | |3 |C | +----+-----+ select * from B +----+-----+ |id |val | +----+-----+ |1 |A | |2 |B | |3 |C | |4 |A | +----+-----+ Will the results returned by the following queries differ? 1 select * from A left join B on A.id = B.id and B.val = 'A' 2 select * from A left join B on A.id = B.id where B.val = 'A'

Middle
115

Propose an algorithm to determine the subscriber's birthday using only call and SMS logs: incoming and outgoing numbers, date-time, duration, and event type.

Middle
109

Tables product (information about the category to which the product belongs within a date range) and sale (sales facts with date, unit price, and quantity): select * from product |prod_nm |prod_cat |eff_dt |exp_dt | |--------|---------|-----------|-----------| |Product 1|Category 1|[phone]|[phone]| |Product 1|Category 2|[phone]|[phone]| |Product 2|Category 3|[phone]|[phone]| select * from sale |sale_dt |prod_nm |price|cnt| |----------|---------|-----|---| |[phone]|Product 1|10 |5 | |[phone]|Product 1|15 |2 | |[phone]|Product 4|15 |2 | |[phone]|Product 3|15 |2 | |[phone]|Product 2|10.9 |300| |[phone]|Product 1|12.7 |7 | Write a query that returns total revenue per category: |prod_cat |total_amt| |----------|---------| |Category 1|80 | |Category 2|84 | |Category 3|270 |

Middle
108

How to classify sales of products that do not fall into any category as "Other"?

Middle
107

There are three incandescent lamps in the room, outside are three switches. All are off, and you can only enter the room once. How can you determine which switch controls each lamp?

Middle
103

You need to write a query that returns the total revenue for each category: |prod_cat |total_amt | |Category 1|80 | |Category 2|84 | |Category 3|270 | There is a table of subscribers with records that came at different times. The record upload date is defined in the raw_dt field: select * from abnt |id |msisdn |tarif_plan_id|account_id|raw_dt | |1 |[phone]|4375 |4979 |[phone]| |1 |[phone]|5842 |4979 |[phone]| |2 |[phone]|5842 |589783|[phone]| |2 |[phone]|4563 |5326 |[phone]| |2 |[phone]|4563 |0832 |[phone]| |3 |[phone]|4563 |0832 |[phone]| |3 |[phone]|5495 |7485 |[phone]| |3 |[phone]|4563 |0832 |[phone]| You need to write a query that returns the second last uploaded record by the id key: |id |msisdn |tarif_plan_id|account_id|raw_dt | |1 |[phone]|5842 |4979 |[phone]| |2 |[phone]|4563 |0832 |[phone]| |3 |[phone]|4563 |0832 |[phone]| There is a table of subscribers with a change history. Each record for a subscriber is valid within the period from valid_from_dt to valid_to_dt. If one record is closed, the next record starts from the same date. There should be only one active record for each subscriber within the interval [valid_from_dt, valid_to_dt]. select * from abnt |id |valid_from_dt|valid_to_dt|msisdn |tarif_plan_id|account_id| |1 |[phone] |[phone] |[phone]|4375 |4979 | |2 |[phone] |[phone] |[phone]|5842 |589783| |2 |[phone] |[phone] |[phone]|4563 |5326 | |3 |[phone] |[phone] |[phone]|4563 |0832 | You need to write a query that returns records with incorrect closing dates: |id |valid_from_dt|valid_to_dt|msisdn |tarif_plan_id|account_id| |2 |[phone] |[phone] |[phone]|5842 |4979 | |2 |[phone] |[phone] |[phone]|4563 |5326 | with ranked as ( select msisdn, tarif_plan_id, account_id, raw_dt, row_number() over (partition by id order by raw_dt desc) as rn ) select id, msisdn, tarif_plan_id, account_id, raw_dt from ranked where rn = 2 order by id

Middle
103

You need to write a query that returns the second to last loaded record by id: |id |msisdn |tarif_plan_id|account_id|raw_dt | |------------|-----------|-------------|----------|-----------| |[phone]|5842 |4979 |[phone]| |[phone]|4563 |0832 |[phone]| |[phone]|4563 |0832 |[phone]| There is a table of subscribers with change history. Each record for a subscriber is valid within the period from valid_from_dt to valid_to_dt. If one record is closed, the next record starts from the same date. There should be only one active record for each subscriber in the interval [valid_from_dt, valid_to_dt]. select * from abnt |id|valid_from_dt|valid_to_dt|msisdn |tarif_plan_id|account_id| |--|-------------|-----------|-------------|-------------|----------| |1 |[phone] |[phone] |[phone] |4375 |4979 | |1 |[phone] |[phone] |[phone] |5842 |4979 | |2 |[phone] |[phone] |[phone] |4563 |5326 | |2 |[phone] |[phone] |[phone] |4563 |0832 | You need to write a query that returns records with incorrect closing dates. |id|valid_from_dt|valid_to_dt|msisdn |tarif_plan_id|account_id| |--|-------------|-----------|-------------|-------------|----------| |1 |[phone] |[phone] |[phone] |5842 |4979 | |2 |[phone] |[phone] |[phone] |4563 |5326 |

Middle
83