Skip to content

Tag: sql

MYSQL joining two table slow

I have 2 main table in MYSQL DB. I will call it entityA and entityB. There are some logic that user will start to create a entityA and then convert it to entityB but some time they will not create entityA and only create entityB Therefore, I have created a middle table which stored entityAId and entityBId. en…

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. …