Skip to content

Single table or multiples tables (multiple company database)

I have to create a database for multiple companies, I have 2 options A single products table, with a company_id field to differentiate One table per company products_company1 products_company2 products_company3 Important: Data stored of each client will be updated every 1 hour Each company has 2000 – 30…

Stuck on getting deps through a query

I have a table, called refs, which has columns such as: depname, refname, reftype. Where, refname is the name of the table dependent on a view. For this use case, I want to get all the views directly or indirectly dependent on table(s) containing ‘sapphire’ in their name. I’m not sure how to…

spring batch table size limit

I am currently trying to read a table with about 5 million records using spring batch. After several minutes I got the follwing exception: org.springframework.batch.item.ItemStreamException: I am using a simple query: select * from table When using a query with a limit like select * from table limit 10000 it …

SQL SUM values by DISTINCT column after JOIN

I’ve been searching the forums for a solution for hours now but I couldn’t quite find the one that is fitting for my problem. I have two tables: members **************** id name city 1 John Boston 2 Maria Boston 3 Steve London 4 Oscar London 5 Ben Singapore donations ******************** member_id…

Need to handle custom query summation for group

I have this table name “TB1” contain of these columns : I need a group with Bill.NO with sum column qty ,price from “TB1” to be like this : What I tried to do , I wrote this query but not doing as I want : Answer Really, you should leave these kind of things to the presentation layer. …

phpmyadmin how can i create a event like this?

I am creating an event on one of my databases to check if the client changed a specific parameter called ‘serverlog’ which is a boolean on my Sql database. Is there a way to loop through all the users in a table called ‘users’, check if ‘serverlog’ is false and update/set a…

How to find the average time? SQL Server 2017

I have a request like this: I need to find the average time for each status. For example, add up the time of all statuses 2 and divide by their number. As a result, get something like 2 days 5 hours. How to fix my request to make belt operations possible? Answer Taking your limited example data, something lik…