Skip to content
Advertisement

Tag: sql

Oracle Count even if nothing is there

So i have this query: It will return stuff from place and then d is another table describes. It will get the number of reviews the place has and the average rating. This works perfectly fine as long as there is something in the describes table. How can i go about getting the stuff that does not have anything in

Computed / calculated / virtual / derived columns in PostgreSQL

Does PostgreSQL support computed / calculated columns, like MS SQL Server? I can’t find anything in the docs, but as this feature is included in many other DBMSs I thought I might be missing something. Eg: http://msdn.microsoft.com/en-us/library/ms191250.aspx Answer Up to Postgres 11 generated columns are not supported – as defined in the SQL standard and implemented by some RDBMS including

SQL Select between dates

I am running sqlite to select data between two ranges for a sales report. To select the data from between two dates I use the following statement: This statement grabs all the dates even those outside the criteria. The date format you see entered is in the same format that I get back. I’m not sure what’s wrong. Answer SQLLite

Extract first numeric part of field

I have a database (Postgres 7.4) field for address Example Data The queries I get all but I don’t want 123 main street I get the results I want My question is how do I just match the numeric part of the address? Answer Returns 1 or more digits from the start of the string. Leave out the anchor ^

How to COUNT duplicate rows?

I want to be able to create a histogram out of a tuple containing two integers values. Here it is the query: For this input: Would be: How can I create a histogram of those values? In other words, how can I count how many times a row has a duplicate? Answer The question leaves room for interpretation. This test

how to avoid duplicate on Joining two tables

This result is 2 times A even after using disticnt . My expected result will have only one A. if i remove row_number() over() as rownum its working fine. Why this is happening ? how to resolve. AM using DB2!! Answer There are two rows in marks Table with id = 1 and mark = 50.. So you will get

Advertisement