cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

display password as shown in example using spark scala

sannycse
New Contributor II

Table has the following Columns:

First_Name, Last_Name, Department_Id,Contact_No, Hire_Date

Display the emplopyee First_name, Count of Characters in the firstname,password.

Password should be first 4 letters of first name in lower case and the date and month of Hire_date

Example:

First_Name: SANJEEV

Hire_Date: 25-02-2016

Then password should be SANJ2502

1 ACCEPTED SOLUTION

Accepted Solutions

Hubert-Dudek
Esteemed Contributor III

@SANJEEV BANDRUโ€‹ ,

SELECT 
   CONCAT(substring(First_Name, 0, 2) , substring(Hire_Date, 0, 2), substring(Hire_Date, 3, 2)) as password
FROM
   table;

If Hire_date is timestamp you may need to add date_format()

View solution in original post

2 REPLIES 2

Hubert-Dudek
Esteemed Contributor III

@SANJEEV BANDRUโ€‹ ,

SELECT 
   CONCAT(substring(First_Name, 0, 2) , substring(Hire_Date, 0, 2), substring(Hire_Date, 3, 2)) as password
FROM
   table;

If Hire_date is timestamp you may need to add date_format()

Hi @SANJEEV BANDRUโ€‹ ,

Just checking if you still need help or if @Hubert Dudekโ€‹ 's response help you to resolve your question? please let us know.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group