SQL - SELECT * FROM database.table ORDER BY uit asc [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 5 months ago.
Improve this question
enter image description hereI would like to SELECT from a table where column uit consist value from 20 to 100 included. please find the attached pic as an example. After select by uit column, it will show the highlighted portion only (included "index", "index_","sales","return" and other 300+ columns)
for example: SELECT * FROM database.table ORDER BY or where...
Thank you very much!
enter image description here

SELECT
*
FROM
database.table
WHERE
"uit " BETWEEN 20
AND 100
The BETWEEN operator is inclusive: begin and end values are included - w3schools.com

Related

In Sql developer ,How to remove the last 3 digit from string in all rows for one column? [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 9 months ago.
Improve this question
Colum2
Karim_bk
Karim_bk
Karim_bk
Want result Karim
This should work
select top 10 Lastname, LEFT(Lastname, LEN(Lastname) - 3) as TrimmedVersion from tablename
Hope this will help you. In Oracle:
SELECT SUBSTR(column_name, 0, LENGTH(column_name) - 2) from table_name;
--SELECT SUBSTR('karim_bk', 0, LENGTH('karim_bk') - 2) from dual; --karim

Counting word frequency [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
I am trying to sum the frequency of the words cumulatively in PostgreSQL
Here's my table (example)
I need sum accumulative frequency for same words, for example the expected results is:
resize (100 + 85) = 185
trabajar (75 + 73) = 148
partir (64) = 64
How can I make the query?
you need to use GROUP BY :
SELECT
word
, SUM(frecuency)
FROM tablename
GROUP BY word

How to get number without null before dot? [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
I need
.00012 $
from 0.00012
but
1.0002 $ from 1.0002
Is this possible in postgress?
You can use something like below -
With t as
(Select 1.0002 As Value
UNION ALL
Select .00012 As Value
)
Select to_char(Value,concat('FM$999,999,999,990D',repeat('0',length(cast(Value as varchar))-2))) from t;
Below is a DB fiddle link to illustrate - https://dbfiddle.uk/?rdbms=postgres_9.5&fiddle=a8e9a3207305b011f5bf7be58ce04180
EDIT : As I thought more about the problem, I realized that the solution above would work for the examples that you have shared but it is not a generalized solution. Below would be a more general approach to solve the problem :
With t as
(Select 1.0002 As Value
UNION ALL
Select .00012 As Value
UNION ALL
Select 100.003 As Value
UNION ALL
Select 12.34456 As Value
UNION ALL
Select 5000.30 As Value
)
Select to_char(Value,concat('FM$999,999,999,990D',repeat('0',length(cast(Value as varchar))-length(cast(ROUND(Value,0) as varchar))-1))) As Amt from t;
DB fiddle link - https://dbfiddle.uk/?rdbms=postgres_9.5&fiddle=ff6f59fdd499941ee1cb1e0fc57e08ca

Select a part of a selected item in sql [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 8 years ago.
Improve this question
How can I possibly select a part of a row data in MS Sql?
ex. Charmina (Female)
All I want to select is the Female not the whole Charmina (Female)
Try this
select substring('Charmina (Female)',
charindex('(','Charmina (Female)')+1,
LEN('Charmina (Female)')-charindex('(','Charmina (Female)')-1)
or
select stuff('Charmina (Female)',1,charindex('(','Charmina (Female)')-1,'')
You may Use SUBSTRING to get sub sequences of strings
SELECT SUBSTRING( your_Raw ,start , length ) AS Alias
FROM Your_Table

Assign values to sorted result in SQL [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 9 years ago.
Improve this question
I have got table like below after sorting in SQL:
M_ID
-----
2013/01
2013/02
2013/03
2013/04
2013/05
2013/06
Now I want to assign each entries a particular value like below
M_ID Days
--------------
2013/01 20
2013/02 30
2013/03 40
2013/04 50
2013/05 60
2013/06 70
So, can you please let me know how to do that in SQL Query?
Do you mean something like this (presuming sql-server)?
SELECT M_ID,
Days = (ROW_NUMBER()OVER(ORDER BY M_ID) + 1) * 10
FROM dbo.TableName
Demo