Category "sql"

Postgresql Multiple counts for one table

From two columns in my table I want to get a unified count for the values in these columns. As an example, two columns are: Table: reports | type

MySQL Query error using UNION/UNION ALL and Group By

Generate the following two result sets: 1). Query an alphabetically ordered list of all names in OCCUPATIONS, immediately followed by the first letter of each

Find the number of employees in each department - SQL Oracle

I have two tables Emp and Dept and I am trying to display how many people work in each department along with their department name, but I can't get it to work.

SQLite3.exe shell not successfully creating database?

I am trying to create a sqlite3 database on my windows 7 64 bit machine. I have downloaded sqlite-shell-win32-x86-3071700.zip from http://www.sqlite.org/downloa

SELECT inside a COUNT

I would like to embed a SELECT inside a COUNT, but I can't find any examples. #pseudosql SELECT a AS current_a, COUNT(*) AS b, COUNT( SELECT FROM t WHERE a

QueryDsl BooleanBuilder: How to create a predicate that compares another field?

I have simple example: to find all items that are sold out. Item has initialQuantity and soldQuantity integer fields. (for some reason I need initialQuantity

Sql Server query varchar data sort like int

I have one table like CREATE TABLE table_name ( P_Id int, amount varchar(50) ) Data Like Id amount ---------- 1 2340 2 4568 3 10000 Now I want to sort t

Replace last two characters in column

I have a column with dates in the format 201201, 201202, 201203 etc. This is a financial database so there is a period 13; however periods 12 & 13 are comb

Query to get only numbers from a string

I have data like this: string 1: 003Preliminary Examination Plan string 2: Coordination005 string 3: Balance1000sheet The output I expect is string 1:

MySQL - How do I enter NULL?

In SQL, I know I can do: UPDATE TableA SET MyColumn=NULL But, how do I enter NULL into a cell graphically? I tried entering 'null' and 'NULL' and '' (nothing/e

MySQL - How do I enter NULL?

In SQL, I know I can do: UPDATE TableA SET MyColumn=NULL But, how do I enter NULL into a cell graphically? I tried entering 'null' and 'NULL' and '' (nothing/e

MySQL - How do I enter NULL?

In SQL, I know I can do: UPDATE TableA SET MyColumn=NULL But, how do I enter NULL into a cell graphically? I tried entering 'null' and 'NULL' and '' (nothing/e

Getting maximum value of float in SQL programmatically

Is there an method for programmatically (in T-SQL) retrieving the maximum (and minimum) value of a datatype? That it would act like float.MaxValue in C#. I wou

Getting maximum value of float in SQL programmatically

Is there an method for programmatically (in T-SQL) retrieving the maximum (and minimum) value of a datatype? That it would act like float.MaxValue in C#. I wou

How do I return a list of all column titles in a table in SQLite? [duplicate]

I have a 20-or-so column table 'Contacts' in a Contacts.sqlite file. I use the Mac Terminal to interact with it, and am writing a program tha

Getting maximum value of float in SQL programmatically

Is there an method for programmatically (in T-SQL) retrieving the maximum (and minimum) value of a datatype? That it would act like float.MaxValue in C#. I wou

Getting maximum value of float in SQL programmatically

Is there an method for programmatically (in T-SQL) retrieving the maximum (and minimum) value of a datatype? That it would act like float.MaxValue in C#. I wou

How do I return a list of all column titles in a table in SQLite? [duplicate]

I have a 20-or-so column table 'Contacts' in a Contacts.sqlite file. I use the Mac Terminal to interact with it, and am writing a program tha

How do I return a list of all column titles in a table in SQLite? [duplicate]

I have a 20-or-so column table 'Contacts' in a Contacts.sqlite file. I use the Mac Terminal to interact with it, and am writing a program tha