Posts

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

How to Decode TLV Quickly

Image
TLV format contains three parts Tag, Length, and value. In a credit card or financial transactions, the TLV protocol supports this format. Below, you will find the ideas to decode TLV data quickly.  According to IBM , the tag tells what type of data it is. The length field denotes the length of the value. The value-field denotes the actual value. Structure of TLV. TLV comprises three field values. Tag Length Value How to Decode TLV The EMV labs developed tags which in turn part of EMV protocol. Each tag has an unique meaning. And the Tag and Length together takes 1 to 4 bytes of memory. 1. The Best example for TLV. Below is the way to decode the EMV tag. The first part of the TLV format is TAG. The second part is LENGTH, and finally the VALUE. Syntax of EMV tag: [Tag][Value Length][Value] (ex. " 9F40 05 F000F0A001 ") where,  Tag Name =  9F40 Value Length (in bytes) =  05  Value (Hex representation of bytes. Example, "F0" – 1-byte) =  F000F0A001 Finally, what is 9F40

Machine Learning The Best Book for Beginners

Image
You need a mix of different technologies for Data Science projects. Instead of learning many skills, just learn a few. The four main steps of an ML project are extracting the data, model development, artificial intelligence, and presentation. Attending interviews with many skills is not so easy. So keep the skills short. Best Machine Learning Book for Beginners A person with many skills can't perform all the work. You had better learn a few skills like Python, MATLAB, Tableau, and RDBMS. So that you can get a job quickly in the data-science project. Out of Data Science skills, Machine learning is a new concept. Why because you can learn Python, like any other language. Tableau also the same. Here is the area that needs your 60% effort in Machine learning.   Machine Learning The Best Book. Related Posts How to write multiple IF-conditions in Python Simplified

Python 'getsizeof' Command the Real Purpose

Image
Here's a sample python program to get the size of a List array.  Getting the number of elements present in a List is not easy. So how to get this? To do you need the 'getsizeof' command. Import 'sys' Library. You need to import the 'sys' library to use the SIZE commands.  >>> import sys Congrats to you since you have now imported the SYS library. The command name is " getsizeof" . Check the below example. print("An Integer:") i = int(100) print(sys.getsizeof(i)) The result will be: 100 What is the size command?  - is to get the size of elements. It gives the result based on the object you are being used. Suppose, if you use Strings, you will get String length. How to use the  'getsizeof' command? Example:1 print("Empty string:") empty_string = "" print(sys.getsizeof(empty_string)) Example:2 print("A normal string") s = "Hello world" print(sys.getsizeof(s)) Example:3 print("Incr

How to Check If Statement Multiple Conditions in Python and Ensure Tidy Code

Image
Here're examples for Python multiple if conditions (statements). These are useful for interviews and projects. Many programmers confuse to write IF logic in Python. Below examples useful for your quick reference. Multiple IF Conditions IF, IF IF 'ELSE' IF 'or' IF 'and' Nested IF IF 'continue' IF 'break' In Python, the decision-making logic you can write with IF condition. You can write multiple IF conditions (Single way decision). At the same time, you can write IF and ELSE conditions (Two-way decision). Multiple IF conditions the best example. def main():         celsius = float(input("What is the Celsius temperature? "))         fahrenheit = 9/5 * celsius + 32         print("The temperature is", fahrenheit, "degrees Fahrenheit.")  # Print warnings for extreme temps         i f fahrenheit > 90:                print("It's really hot out there. Be careful!")         if fahrenheit < 30:        

How to write Regular expression Quickly in python and Examples

Image
Regular Expressions purpose is to find matching string in another string. You will get either 'True' or 'False' as a response. I am not sharing here how to play tennis. My intention is if you just follow ideas, you can play tennis today.   Python Regular Expressions What is a regular expression How does python support Best examples 1. What is regular expression >>> haystack = 'My phone number is 213-867-5309.'  >>> '213-867-5309' in haystack True This is just a fundamental use of the regular expression. The real use of Regular Expression comes here. That is - to find if the main has any valid phone number. Regular expressions also called regexes. 2. Why do we need regx Data mining - to get required data if it is present are not Data validations - to get an answer if the received string is valid or not. Python support Python has its own regular expression library. That is called re . What you need to do is just import it. >>>imp

Python How to Create Function

Image
In Python, you can define and call the function. Once done, you can call it later from the other program. I have shared the structure of it. And, I have added the three rules of it; useful for interviews. Structure of Function Structure of Function Rules to Create a Function A function definition is executable. The body will have the code to perform the task you wish. You can assign default parameter values. 1. Key Elements. You will find here three key elements of the Python function. Here you can read the parameter vs argument differences . Name of a function. It can be any valid identifier. It should be meaningful, and it should convey the work it will do. Parameter. These should be separated with command and should be in the parentheses following the name of the function. The parameters are input to function. It can have any parameters. Body of the function. The function body can contain code that implements the task to be performed by it. 2. Sample Function. Python Example. def

How to Work with 'Pointers' in Python

Image
Pointers denote an address (memory location). It has three identities - Name, Value, and Location (Address). Python doesn't support pointers as-is. You need to import 'ctypes' package to work with C Language. Note : Pointer is popular in C, C++. The called module just uses the value of Pointer (not address).  Below is my detailed post on pointers.   How to work with Pointers To pass a reference(address) to the C interface. You can use C Language in Python by importing 'ctypes.'  Pointer Notation 1. Value 2. Address 3. Name Python Pointers Python doesn't support pointers. C and C++ extensively support pointers. Pointer is nothing but an ADDRESS. It is immutable. That means you can't change the value. Python supports pointers for the purpose to interact with C Language. How to Import 'ctypes' Import 'ctypes' library for the purpose of working with C language.  Here's how to import 'ctypes' for windows and Linux. How to denote Pointe