Skip to content
Advertisement

Tag: postgresql

min and count without limit

I need to select a receipt with 3 conditions: total receipt > 50 (receipt.total) associated purchases doesn’t include item “cucumbers” (product.pname) the number of suppliers (product.sid) of associated products is the lowest I have the following tables set up: sample data: So far I have the following but it is not getting the receipt with the lowest number of sid:

COUNT Multiple Columns using GROUP BY – SQL

I am trying to create a GROUP BY COUNT of ~30 columns in my database. The database is basically a shiftplan, where on each column a row can be assigned different shift types (denoted as a D, N, A, X, F, C, etc..). I can use the following query to get a count of each shift type, am struggling to

Sql Database design hierarchy

I have been tasked to create an app to track our contracts. I am planing to use Django and PostgreSQL. Our existing data is in Excel with 52 rows. I have found an hierarchy pattern in the file which contains as below Holding Office Registered Office Operating Office For example – Holding office (company) can contain one more Registered Office

Create a column based on conditions in select statement

I have an order table in Postgres with order number and status as column. If a new order is placed the default status were Order placed and Goods Assigned. order 12345 order 543223 I want to know if the order were out from the sender place. So I want to create a column called started and has value Yes if

Advertisement