Skip to content

Tag: sql

Connect MQTT Message with clienID of Publisher

I want to store MQTT data in an MySQL db and want to store the client id, topic and message content. With some devices, I have no control over the topic or message syntax, so it will not be possible to attach the client id to the message or add the client id in the topic. Is there a possibility

how to make cohort analysis in mysql

I have a table called order_star_member: DB Fiddle I want to find users in the month March with transaction >= 700000 and first transaction >= 700000. The user whose transaction is >= 700000 is called star member. My query so far: Explanation: in march 2021, there’s only one ‘star member&…

how to rollback tran when error occur in oracle

i try to solve 2 requests below but i only code for the first one,, can any one help to solve the second one Write SQL statements using cursor to update salary of all employees base on update conditionals Make sure all update records have been updated completely. The database transaction will be rolled back i…

Find students who take most courses SQL

Assume there’s a table students containing student id, semester id and number of courses taken in each semester: How can I find students in each semester who took the largest number of courses? Expected output would be: I thought of using OVER PARTITION BY, but I’m not sure how to use it correctly…