How can I limit some specific numbers and return them with a title? [closed] - sql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 days ago.
Improve this question
I have a table in postgresql which contains scores of students and I wanna show scores less than 10 with word 'failed' and more than 10 with the word 'passed'. How can I do that using a query?
As result I want a table with two columns. First scores and second 'passed' or 'failed'.

Related

I have a data set that has a column with hundreds of dates listed out like "August 21, 2020" and so on.I want to extract only the month (SQL) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 10 months ago.
Improve this question
enter image description here
Here is a snapshot of some of the data I am trying to extract only the month and place this into a new table. This is in SQL.
select month(convert(date,<table_date>,101))

Need to write where condition consists of 2 groups [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 11 months ago.
Improve this question
I want to write where condition in a SQL Server query which has following conditions:
Where paymentmode='Bank' and Status not equal to Paid
payment mode='cash' and sataus not equal to completed
How I can write these 4 condition b
We put the sets of conditions in brackets. In the following either all the conditions in the first parenthesis must be met or all those in the second.
Where
(paymentmode='Bank'
and Status <> 'Paid')
Or
(paymentmode='cash'
and status <> 'completed')

Count without duplicates [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last year.
Improve this question
I'd like to count column values without any duplicates.
In the given example, I'd expect the SQL query to sum up column a to 6 (every value counted once)
How about
select count(distinct a)
from table

SQL how to find number of unique id's [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
enter image description here
enter image description here
Hi, I was wondering how I will find the number of unique (different) customers found in the list above. I have shown the code I have written up but not sure how to get unique Customer ID count as you can see there are many duplicate customerID's because each customer can match with many products.
You can use count(distinct):
select count(distinct customer_id)
from t;

SQL Image field divided by 2 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Could anyone help me on the below please?
I have a field called F1.Images and I need to divide by 2 ONLY when my other field W1.Plex is Duplex else I need to retain the F1.Images count.
Thanks Satya
Sorted Brad.
Used Case/When logic. Here's the Answer:
Case
WHEN W1.Plex = 'Duplex' then (F1.images / 2)
Else F1.images
End AS Pages