Posts

Showing posts with the label assign multiple values

Featured Post

SQL Interview Success: Unlocking the Top 5 Frequently Asked Queries

Image
 Here are the five top commonly asked SQL queries in the interviews. These you can expect in Data Analyst, or, Data Engineer interviews. Top SQL Queries for Interviews 01. Joins The commonly asked question pertains to providing two tables, determining the number of rows that will return on various join types, and the resultant. Table1 -------- id ---- 1 1 2 3 Table2 -------- id ---- 1 3 1 NULL Output ------- Inner join --------------- 5 rows will return The result will be: =============== 1  1 1   1 1   1 1    1 3    3 02. Substring and Concat Here, we need to write an SQL query to make the upper case of the first letter and the small case of the remaining letter. Table1 ------ ename ===== raJu venKat kRIshna Solution: ========== SELECT CONCAT(UPPER(SUBSTRING(name, 1, 1)), LOWER(SUBSTRING(name, 2))) AS capitalized_name FROM Table1; 03. Case statement SQL Query ========= SELECT Code1, Code2,      CASE         WHEN Code1 = 'A' AND Code2 = 'AA' THEN "A" | "A

Python: Store Multiple Values in a Variable

Image
In Python, you can assign values to the variables. This post tells you how to assign values to multiple variables. It is common assigning values in any programming language. But Python simplifies your job by introducing this technic. Here is  Python For Loop Tricky Example . Python Assigning the Values At once. a = 1 b = 1 c = 1 d = 1 or, you can assign simultaneously as; a=b=c=d=1 Python Assigning Multiple Values at Once The other way you can assign as; a, b, c, d = 10, 1, 3.5, 'Srini' From the above, you can understand as below: The '10' assigns to a. The '1' assigns to b. The '3.5' assigns to  c. Then 'Srini' to d.  References Python Basics Variable Assignment