Skip to content

Tag: sql

Add a number for duplicate values in posgresql

I’ve a query in MySQL and I’m looking for a query which can perform below operation using Posgres MySQL Query : Output: Email Row Number Aamir 1 Aamir 2 Aamir 3 Suresh 1 Suresh 2 Hafiz 1 Answer https://www.db-fiddle.com/f/3RqNHRGFjkU74v33upyfhi/0

Complex multi-level JSON and SQL – what am I doing wrong?

So I am able to query my JSON file fine then I wanted to add another field that is under a few levels and when I try to do this – it doesn’t work. What am I doing wrong? So the following works correctly and gives me back the first level promoter id This does not work – I get

show who resit and passed and what course was it?

i need help find who fail in exam & resit and pass the exam only, heres the code: heres the result: I need find like this: Answer Possibly using a query like below. this is using your query as input. Also we have assumed that it is not possible to have a student have (PASS, FAIL) for a student on

How to calculate win chance ticket in percentage

I’m trying to calculate a win chance from buying a freebies ticket in the percentage of each user that has been recorded in the database here is my freebies table the total number of tickets is 10 user id 60 have a 5 tickets user id 50 have a 3 tickets user 4 have 2 tickets so I want to