Convert array of bigint into int in sparksql or in Pyspark [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 8 days ago.
Improve this question
I have a column X of type array(bigint) in Table 1, I need to join table 1 with another table 2 and filter the rows on column X in sparksql. To do this, I need to cast the column X which is array(bigint) to int. How can I do this?
appreciate any help.

Related

How to remove repeat rows 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 3 years ago.
Improve this question
I need to remove repeated records in search result. I have 3 columns (id, worklevel & umobile).
It looks like below:
Red places is repeat but I need just one of them in result.
Try using DISTINCT
SELECT DISTINCT column1, column2, ...
FROM table_name;

How to update only the year of the date column in a table - sql oracle [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 3 years ago.
Improve this question
I was looking for the query which can update only the year of the date column to 2019.
yes you can,
if the field of the date for you mydate from table_name, you can do:
Update table_name
set column_name = Add_months(sysdate, -(extract(year from sysdate)-extract(year from mydate))*12)
where <where_condition>;

Selecting columns with values ​greater than 0 [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 3 years ago.
Improve this question
i have only one row with a lot columns in my table. I want to select columns with values greater than zero.
WHERE (col_1 > 0) and ... (col_99 > 0)
It will be too long query, if i want to write all statements. Does it possible to write query with selecting columns with values > 0 ?
Bro flow the method its lengthy by works.
First you unpivot the data and select values where column value > 0
secondly Pivot again and you will get you desire result.

sql same table same column but two data [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 7 years ago.
Improve this question
TABLE1
NAME
1. AHMET
2. MEHMET
3. VELİ
4. TEMEL
Select * from TABLE1 WHERE NAME='AHMET' and NAME='VELİ'
Probaly you want IN operator:
Select * from TABLE1 WHERE NAME IN('AHMET', 'VELİ')

Problems with SQL query finding three names with the most records [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
I have a table and I want to display the 3 names (Ted, Ringo, Paul) that have the most records using an SQL query.
It's a primitive question, but please help me.
my table:
SELECT TOP 3 Name
FROM YourTable
GROUP BY Name
ORDER BY COUNT(*) DESC