Skip to content

Tag: database

Top 3 Values in the Same Row

I am working on Steam data and need to find the top 3 tags people used for each game but the problem is all the tag values are in the same row for each game like the image below (appid column then 370 column for each tag and values). Result can be anything like 200,300,400 or column name plus tag

N:M Relationship between users and guests

I’m building an app that can assign guests to an existing user. Those guests can see some information about the users they are associated with. It’s N:M: Users can have multiple guests associated Guests can be associated to multiple users Under the hood they are stored in the same table, the only …

Oracle SQL Roll up function or alternatives

First, I am finding an average of some data, and then formatting that average into to decimal points. And in the end, I want to use rollup to generate a total row for all columns. The problem is: I want the rollup to sum the data as they appear, however, when adding up the average it is not adding them

Array variable inside DB::raw query laravel

I want to predifine $processingStatus array and use it inside Laravel DB::raw query but this gives me the following error- Syntax error or access violation: 1064 You have an error in your SQL syntax My query is a large one so I am only pasting the fragment which I guess is causing the error- DB::raw(“CO…

SQL Sub-Query Multiple Columns [closed]

I have a dataset containing a list of recorded coronavirus cases in countries across the world through a time period of December 2019 to April 2020. I am trying to write an SQL query to give a a …