Skip to content

Tag: sql

SQL multiple SELECTs very slow to run

I have the following query (Postgres) which gives the correct results, but it is very slow. Any ideas how I can make it faster? SELECT DISTINCT(vesselimo), vesselname, (SELECT COUNT(portid) FROM …

SQL unpivoting columns

How to unpivot table: to this: What I have so far is : but this is giving me count for all months. I need this with month number and count value for that month. Values 1-9 could be any numbers. Answer Got it working with

Oracle Database Object SQL query

In Oracle Database. There are two object tables SHOPS(S_NUM, S_NAME, TEL). And PRODUCTS(P_NUM, P_NAME, P_VAL, P_PRICE, SHOP_NUM). How to write in Oracle Object SQL language query to get how much there …

calculating percentage on multiple sql tables

There are 2 tables mobile and web Table name: Mobile Table name: web I need to calculate percentage of users who only visited : mobile, web and both. That is, the percentage of users who are only in the mobile table, only in the web table and in both tables. The sum should be 1. I tried using union but