Here is my problem. I have two tables like user and customer. Users can be related to some customer(s). For example, I have a user who relates to two customers, and the other user relates to three …
Tag: sql
Postgres database migrations with vault
I am currently using vault to generate database credentials. The service itself handles migrations against the database. I end up with tables owned by the generated vault role. the database …
Sqlite SUM Entity value depending on LEFT JOIN value
I’m using Room on Android to query a POJO. My POJO (Transaction) contains a value and an account_id. It further contains an account (instance of Account), which is fetched by a @Relation. The …
How to remove Repeated field in BigQuery schema?
I have a schema that has a repeated field nested into another repeated field like so: person.children.toys. I want to make this inner field not repeated (so child can have only single nullable toy). I …
Count rows that don’t match between two tables within a group
I have two tables, each with a user_id, and group_name columns. E.g. table1: | user_id | group_name1| ———————— | 1 | ‘groupA’ | | 1 | ‘groupB’ | | 2 | ‘…
How to calculate the percentage of salary paid by each account for each employee?
I need to find the percentage of an employee’s salary that is paid by each account. For example.. I need to find a way to sum the amounts of each employee and then divide each amount by that total. …
Which one is the most optimal way to delete and update query in mysql?
Suppose, I need to delete or update some id informations from my database, which would be the best way to do it? Should I first find out that if that id exists or not? Or should I update the data then …
Create chart where the columns of the data set are the categories – Report Builder 3.0
I have a very simple chart that I am wanting to add but I can’t for the life of me figure it out. The chart is referencing a dataset that returns data like this. It is calculating the sum of each …
How to group this table properly?
Here’s my dataset with expected out. But I am having issues doing it. Also, I attached the query I created and the output is not correct. could you please point me to where my mistake is? DROP TABLE …
How do I display my query results as part of a string?
My database is for a school project and handles various jobs/contracts which are ran by consultants. Apologies if the context is vague, we haven’t really been given much either. My current code does …