Skip to content

Tag: sql

Query columns based on values of table

I’m new to DB and SQL so I don’t know if there is anything new I need to try for this. I want to solve this table my senior has given to me: Passbook(Table Name) Date | Amount | Type ———-…

SQL Select: Evenly Distribute Results Set

I have a table called TableA, with a Color column. Nine rows total, if I select * from TableA order by Color, I get results set blue blue blue green green green red red red how do I distribute …

Performance for Avg & Max in SQL

I want to decrease the query execution time for the following query. This query is taking around 1 min 20 secs for about 2k records. Numbers of records in table: 1348474 Number of records processed through where query: 25000 Number of records returned: 2152 I tried removing the AVG & MAX columns and it lo…

how to pick the column with the highest value

I have a table with different possibilities of marital status (columns), how do I pick up the one with the highest value and keep the column name? For example, below is my original data set: data …