0% found this document useful (0 votes)
7 views4 pages

2 Day Python SQL Interview Preparation Guide

This document outlines a 2-day interview preparation guide focusing on Python and SQL. Day 1 emphasizes Python basics, including loops, data types, and logic practice through small programs, while Day 2 focuses on writing and explaining SQL queries. The guide also includes tips for verbal preparation and structuring answers effectively.

Uploaded by

stationfunstop
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

2 Day Python SQL Interview Preparation Guide

This document outlines a 2-day interview preparation guide focusing on Python and SQL. Day 1 emphasizes Python basics, including loops, data types, and logic practice through small programs, while Day 2 focuses on writing and explaining SQL queries. The guide also includes tips for verbal preparation and structuring answers effectively.

Uploaded by

stationfunstop
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

2-Day Python + SQL Interview Preparation Guide

Day 1: Python Revision and Logic Practice

Time Needed: ~3-4 hours


Goal: Be confident with Python syntax, loops, and logic.

Revise Python Basics:


- Loops (for, while)
- Data types: list, tuple, dict, set
- Functions and return statements
- String slicing and list comprehension

Difference Between List and Tuple

List:
- Mutable (can be modified)
- Declared using square brackets []
- Slower than tuples
- Used when data may change
Example: marks = [85, 90, 92]

Tuple:
- Immutable (cannot be modified)
- Declared using parentheses ()
- Faster and memory efficient
- Used when data is fixed
Example: coordinates = (10, 20)

Practice 5 Small Logic Programs

1. Check Even or Odd Number


----------------------------
num = int(input("Enter a number: "))
if num % 2 == 0:
print("Even Number")
else:
print("Odd Number")

2. Find Factorial of a Number


----------------------------
num = int(input("Enter a number: "))
factorial = 1
for i in range(1, num + 1):
factorial *= i
print("Factorial:", factorial)

3. Check if a String is Palindrome


----------------------------
s = input("Enter a string: ")
if s == s[::-1]:
print("Palindrome")
else:
print("Not Palindrome")

4. Reverse a String
----------------------------
s = input("Enter a string: ")
reverse = s[::-1]
print("Reversed String:", reverse)

5. Find Maximum Number in a List


----------------------------
numbers = [12, 45, 67, 23, 89, 34]
print("Maximum number is:", max(numbers))

Watch a 20-minute SQL crash video on GROUP BY, JOIN, HAVING.

Day 2: SQL Practice and Verbal Preparation


Time Needed: ~3 hours
Goal: Write and explain SQL queries confidently.

Write 5 SQL Queries on Paper:

1. Find Total Salary per Department


----------------------------
SELECT department, SUM(salary) AS total_salary
FROM employees
GROUP BY department;

2. Find Second Highest Salary


----------------------------
SELECT MAX(salary) AS second_highest_salary
FROM employees
WHERE salary < (SELECT MAX(salary) FROM employees);

3. Find Duplicate Salaries


----------------------------
SELECT salary, COUNT(*) AS count
FROM employees
GROUP BY salary
HAVING COUNT(*) > 1;

4. Join Employees and Departments


----------------------------
SELECT [Link], d.department_name
FROM employees e
INNER JOIN departments d
ON e.dept_id = d.dept_id;

5. Filter Using HAVING (Total Salary > 10000)


----------------------------
SELECT department, SUM(salary) AS total_salary
FROM employees
GROUP BY department
HAVING SUM(salary) > 10000;

Practice speaking your answers aloud - explain the logic before showing the code.
Tip: Structure answers as 'Concept -> Example -> Use Case' for better clarity.

You might also like