No video

111. Databricks | Pyspark| SQL Coding Interview: Exchange Seats of Students

  Рет қаралды 5,826

Raja's Data Engineering

Raja's Data Engineering

Күн бұрын

Azure Databricks Learning: Coding Interview Exercise: Pyspark and Spark SQL
=================================================================================
Coding exercises are very common in most of the Bigdata interviews. It is important to develop coding skills before appearing for Spark/Databricks interviews.
In this video, I have explained a coding scenario to exchange the seats of students in a class. This is Leet Code SQL Exercise number 626. This is also one of the FAANG company question Google, Microsoft, Amazon, Apple, Meta etc.,
Also have customised the scenario a bit and solved the problem. To get more understanding, watch this video
#LeetCodeSQL, #HackerRankSQL,#FAANGCodingQuestion, #GoogleCodingSQL, #AmazonCodingSQL, #MicrosoftCodingSQL,#SQLSeatsExchange,#PysparkSeatsExchange, #CodingInterviewQuestion, #ApacheSparkInterview, #SparkCodingExercise, #DatabricksCodingInterview,#SparkWindowFunctions,#SparkDevelopment,#DatabricksDevelopment, #DatabricksPyspark,#PysparkTips, #DatabricksTutorial, #AzureDatabricks, #Databricks, #Databricksforbeginners,#datascientists, #datasciencecommunity,#bigdataengineers,#machinelearningengineers
Input table:
+------------+--------------+
| id |Student |
+------------+--------------+
| 1 | Alice |
| 2 | Bob |
| 3 | Charlie |
| 4 | David |
| 5 | Eve |
+------------+--------------+

Пікірлер: 37
@GANGAEDIGA
@GANGAEDIGA 3 ай бұрын
For given exercise: exchange_df1 = df.withColumn("ExchageStudent", when (col('id')%2==1 , coalesce(lead('name',3).over(Window.orderBy('id')),col('name'))). when (col('id')%2==0 , coalesce(lag('name',3).over(Window.orderBy('id')),col('name'))). otherwise(col('name')) )
@rajasdataengineering7585
@rajasdataengineering7585 3 ай бұрын
Thanks
@user-du5bs8fk6l
@user-du5bs8fk6l 6 ай бұрын
Assignment Qn: if below approach is incorrect, pls let me know spark.sql("""select id, name, case when id=1 then lead(name,3) over(order by id) when id=4 then lag(name,3) over(order by id) else name end as fname from users""")
@naveenraj9977
@naveenraj9977 Жыл бұрын
Thanks for Sharing the real time scenario, Waiting for more information,Keep it going..!!!!!!
@rajasdataengineering7585
@rajasdataengineering7585 Жыл бұрын
Thanks Naveen, will do!
@sumitchandwani9970
@sumitchandwani9970 Жыл бұрын
Please upload more coding excercise videos they are amazing. Really helpful for developing analytical thinking.
@rajasdataengineering7585
@rajasdataengineering7585 Жыл бұрын
Thanks Sumit! Will upload more videos
@srinubayyavarapu2588
@srinubayyavarapu2588 Жыл бұрын
Sir, Thanks a lot for your commitment and Please Upload more coding exercise videos , This will be the game changer , Respect to you
@rajasdataengineering7585
@rajasdataengineering7585 Жыл бұрын
Thanks Srinu! Glad you liked it Sure we will upload more videos
@ranjansrivastava9256
@ranjansrivastava9256 11 ай бұрын
Really very informative videos, please upload more. you are explaining in very good manner. Keep it going !!!
@zub3rahmed76
@zub3rahmed76 8 ай бұрын
Exactly keep uploading more videos like this
@rajasdataengineering7585
@rajasdataengineering7585 8 ай бұрын
Sure, will create more videos on coding exercises after completing delta live table series soon
@Munchkin_K
@Munchkin_K 2 ай бұрын
You speak continuous, need time to grasp 😊
@rajasdataengineering7585
@rajasdataengineering7585 2 ай бұрын
Thank you for your feedback. I will try to speak slowly
@DineshTelegenic
@DineshTelegenic Жыл бұрын
Thanks for the valuable content.
@rajasdataengineering7585
@rajasdataengineering7585 Жыл бұрын
My pleasure! Glad it helps data engineers
@venkatasai4293
@venkatasai4293 Жыл бұрын
Good explanation Raja . Keep it going .
@rajasdataengineering7585
@rajasdataengineering7585 Жыл бұрын
Thanks Venkat!
@prabhatgupta6415
@prabhatgupta6415 Жыл бұрын
Thanks sir u gave the data. please keep going sir. Please include how to present project infront of interview,manerial round question etc. How to handle big data managerial question. how to dominate interview in our ways.
@rajasdataengineering7585
@rajasdataengineering7585 Жыл бұрын
Sure Prabhat, will create videos on these topics. Thanks for your comment
@nagarajanmurugesan6932
@nagarajanmurugesan6932 Жыл бұрын
Keep up the good work. 🙂
@rajasdataengineering7585
@rajasdataengineering7585 Жыл бұрын
Thanks, will do!
@shakthimaan007
@shakthimaan007 15 күн бұрын
Hi, do you have these codes put somwhere in the github or anywhere please?
@ShubhamSharma-sy2ce
@ShubhamSharma-sy2ce 5 ай бұрын
SELECT id, CASE WHEN student = 'Alice' THEN (SELECT student FROM students_view WHERE student = 'David') WHEN student = 'David' THEN (SELECT student FROM students_view WHERE student = 'Alice') ELSE student END as updated_student, student FROM students_view;
@ShubhamSharma-sy2ce
@ShubhamSharma-sy2ce 5 ай бұрын
in pyspark: updated_students_view = students_view.withColumn("updated_student", when(students_view["student"] == 'Alice', students_view.filter(students_view["student"] == 'David')["student"] ) .when(students_view["student"] == 'David', students_view.filter(students_view["student"] == 'Alice')["student"] ) .otherwise(students_view["student"]) )
@rajasdataengineering7585
@rajasdataengineering7585 5 ай бұрын
Thanks for sharing your approach
@bhanukiran7916
@bhanukiran7916 Жыл бұрын
Thank you😮
@rajasdataengineering7585
@rajasdataengineering7585 Жыл бұрын
You're welcome 😊
@Jangampavan2021
@Jangampavan2021 Жыл бұрын
Thank You ..! Please attach the the notebook
@ATHARVA89
@ATHARVA89 Жыл бұрын
superb!
@rajasdataengineering7585
@rajasdataengineering7585 Жыл бұрын
Thank you! Cheers!
@ranjansrivastava9256
@ranjansrivastava9256 11 ай бұрын
Plz answer the Quiz question.
@TejaswiniNandam
@TejaswiniNandam Жыл бұрын
Great scenario to practice Thanks for providing. I have been following your channel for Spark, and your explanation for every topic is clean and easy to understand for everyone. Here is the code that I practiced, it may help anyone to practice. please let me know of any corrections or suggestions in terms of performance. #creating Dataframe data=[(1,'Alice'),(2,'Bob'),(3,'Charlie'),(4,'David'),(5,'Eve')] df=spark.createDataFrame(data,['id','student']) df.show() #Pyspark solution from pyspark.sql.functions import col,lead,lag,when from pyspark.sql.window import * df.withColumn('new',when (col('id')%2==0,lag('student').over(Window.orderBy('id'))).\ when (col('id')%2== 1,coalesce(lead('student').over(Window.orderBy('id')),'student'))).drop('student').show() #creating tempview df.createOrReplaceTempView('sampl') #sql solution %sql select id,case when id%2=0 then lag(student) over(order by id) when id%2=1 then lead(student,1,student) over(order by id) end new from sampl
@rajasdataengineering7585
@rajasdataengineering7585 Жыл бұрын
Thank you! It looks good. Hope it helps data engineers in this community
@mohammediqbal2406
@mohammediqbal2406 8 ай бұрын
this code is for the assignment which raja sir has given in the last?
115. Databricks | Pyspark| SQL Coding Interview: Number of Calls and Total Duration
16:52
Идеально повторил? Хотите вторую часть?
00:13
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 18 МЛН
Doing This Instead Of Studying.. 😳
00:12
Jojo Sim
Рет қаралды 34 МЛН
Они так быстро убрались!
01:00
Аришнев
Рет қаралды 3,1 МЛН
109. Databricks | Pyspark| Coding Interview Question: Pyspark and Spark SQL
20:46
Raja's Data Engineering
Рет қаралды 15 М.
Write DataFrame into CSV file using PySpark |#databricks #pyspark
8:46
Shilpa DataInsights
Рет қаралды 393
Coding Interviews Be Like
5:31
Nicholas T.
Рет қаралды 6 МЛН
117. Databricks | Pyspark| SQL Coding Interview: Total Grand Slam Titles Winner
19:08
4 Recently asked Pyspark Coding Questions | Apache Spark Interview
28:39
Practice SQL Interview Query | Big 4 Interview Question
14:47
10 recently asked Pyspark Interview Questions | Big Data Interview
28:36