[Go to site: main page, start]

0% found this document useful (0 votes)
32 views8 pages

SQL Azure Interview Questions Guide

The document contains a comprehensive list of interview questions and answers focused on SQL, Python, and Azure, covering topics such as database modeling, data warehousing, programming concepts, and cloud services. It includes comparisons of OLAP vs OLTP, types of data marts, and various SQL operations, along with Python programming fundamentals and Azure cloud services. Additionally, it provides guidance on explaining projects using the STAR method.

Uploaded by

sankarthik9316
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)
32 views8 pages

SQL Azure Interview Questions Guide

The document contains a comprehensive list of interview questions and answers focused on SQL, Python, and Azure, covering topics such as database modeling, data warehousing, programming concepts, and cloud services. It includes comparisons of OLAP vs OLTP, types of data marts, and various SQL operations, along with Python programming fundamentals and Azure cloud services. Additionally, it provides guidance on explaining projects using the STAR method.

Uploaded by

sankarthik9316
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

SQL, Python, Azure Interview Questions

Database & Data Modeling

1. What are the components of an ER model?


Answer: Entities, Attributes, Relationships, and Keys (Primary/Foreign).

2. Explain the multidimensional model.


Answer: Used in OLAP with fact tables (metrics) and dimension tables (descriptive attributes).

3. What is Normalization?
Answer: Process to minimize redundancy (1NF to 5NF).

4. What is Denormalization? Why use it?


Answer: Adding redundancy to improve query performance (common in data warehouses).

5. Name 2 types of schemas in a data warehouse.


Answer: Star Schema (denormalized dimensions) and Snowflake Schema (normalized dimensions).

6. What are the 3 types of data marts?


Answer: Dependent (subset of DW), Independent (standalone), Hybrid (mixed sources).

7. Compare OLAP and OLTP.


Answer:

OLAP (Online Analytical


Aspect OLTP (Online Transaction Processing)
Processing)

Real-time operational processing (e.g., Historical data analysis (e.g., sales


Purpose
orders) trends)

Database Denormalized (optimized for


Normalized (minimizes redundancy)
Design queries)

Short, frequent Complex (SELECT with


Query Type
(INSERT/UPDATE/DELETE) aggregations)

Data Volume Smaller, current data Larger, historical data

Performance Optimized for write operations Optimized for read operations

Example ATM transactions, e-commerce orders Business intelligence dashboards

Users Front-line staff (clerks, cashiers) Analysts, executives


Visual Workflow:
OLTP Databases → ETL → OLAP Data Warehouse → BI Tools

8. What are the 2 approaches to Enterprise Data Warehouse design?


Answer: Top-down (centralized DW first) and Bottom-up (data marts first).

9. Name 4 set operators in SQL.


Answer: `UNION`, `UNION ALL`, `INTERSECT`, `EXCEPT/MINUS`.

10. What are the types of subqueries?


Answer: Single-row, Multi-row, Correlated, and Scalar.

11. What is an index? Explain clustered vs. non-clustered.


Answer:
- Clustered: Physically reorders data (1 per table).
- Non-Clustered: Logical order with pointers (multiple allowed).

12. What is a staging area in a data warehouse?


Answer: Temporary storage for raw data before ETL processing.

13. Explain SCD (Slowly Changing Dimension) types.


Answer:
- Type 1: Overwrite (no history).
- Type 2: Add new row (keeps history).
- Type 3: Track changes in columns.

14. What is incremental loading in ETL?


Answer: Loading only new/changed data (e.g., `WHERE LastModified > last_run`).

15. Write a query to sort records (SQL and PySpark).


Answer:
-- SQL
SELECT * FROM Employees ORDER BY Salary DESC;

# PySpark
[Link]("Salary", ascending=False).show()
Python

16. What is Python?


Answer: High-level, interpreted programming language for automation, data, and web apps.

17. Why is Python used?


Answer: Easy syntax, rich libraries (Pandas, NumPy), and cross-platform support.

18. List Python data types.


Answer: `int`, `float`, `str`, `list`, `tuple`, `dict`, `set`, `bool`.

19. What are numeric data types in Python?


Answer: `int`, `float`, `complex`.

20. What are sequential data types?


Answer: `list`, `tuple`, `str` (ordered sequences).

21. Explain loops in Python (`for`, `while`, `do-while`).


Answer:
# For loop
for i in range(5): print(i)

# While loop
while x < 5: x += 1

# Python has no native `do-while`, but emulate with:


while True:
print(x)
if x >= 5: break

22. What are set operators in Python?


Answer: `|` (union), `&` (intersection), `-` (difference), `^` (symmetric difference).

23. List types of operators in Python.


Answer: Arithmetic (`+`, `*`), Comparison (`==`, `>`), Logical (`and`, `or`), Assignment (`=`).

24. What is a class? Give a real-world example.


Answer:
class Car:
def __init__(self, brand):
[Link] = brand
my_car = Car("Toyota")
25. Explain inheritance with an example.
Answer:
class Animal:
def speak(self): pass
class Dog(Animal): # Inherits Animal
def speak(self): return "Bark"

26. What are the 5 types of inheritance?


Answer: Single, Multiple, Multilevel, Hierarchical, Hybrid.

27. What are function parameters?


Answer: Inputs to functions (e.g., `def greet(name):`).

28. List logical operators in Python.


Answer: `and`, `or`, `not`.
SQL & Database

29. What is SQL?


Answer: Structured Query Language for managing relational databases.

30. What is DBMS? Name types.


Answer:
- Types: Relational (RDBMS), NoSQL, Hierarchical, Network.

31. Explain DDL, DML, DCL.


Answer:
- DDL: `CREATE`, `ALTER`, `DROP`.
- DML: `SELECT`, `INSERT`, `UPDATE`.
- DCL: `GRANT`, `REVOKE`.

32. Compare `TRUNCATE` vs `DELETE`.


Answer:

Aspect TRUNCATE DELETE

DML (Data Manipulation


Type DDL (Data Definition Language)
Language)

Speed Faster (no logging of individual rows) Slower (logs each row deletion)

Resets storage allocation (deallocates


Storage Keeps storage allocated
pages)

Allowed (can delete specific


WHERE Clause Not allowed
rows)

Triggers Does not fire triggers Fires triggers

Transaction Auto-commits (cannot rollback) Can be rolled back

Identity
Resets counter (e.g., IDENTITY(1,1)) Does not reset counter
Columns

Use Case Remove all data quickly Selective deletion

Example:
-- TRUNCATE (remove all data)
TRUNCATE TABLE Employees;

-- DELETE (remove specific data)


DELETE FROM Employees WHERE Salary < 50000;
33. What is a query?
Answer: A request for data (e.g., `SELECT * FROM table`).

34. Give an example of an alias in SQL.


Answer:
SELECT [Link] AS EmployeeName FROM Employees e;

35. What are joins? Explain with syntax.


Answer:
SELECT a.*, b.* FROM TableA a INNER JOIN TableB b ON [Link] = [Link];

36. List types of joins.


Answer: INNER, LEFT, RIGHT, FULL, CROSS, SELF.

37. What is a clause in SQL?


Answer: Conditions like `WHERE`, `GROUP BY`, `HAVING`.

38. How to find the first/last record in a table?


Answer:
-- First
SELECT * FROM Employees ORDER BY HireDate ASC LIMIT 1;
-- Last
SELECT * FROM Employees ORDER BY HireDate DESC LIMIT 1;

39. What are aggregate functions in SQL?


Answer: `COUNT()`, `SUM()`, `AVG()`, `MIN()`, `MAX()`.

40. Write a query to join two tables.


Answer:
SELECT a.*, b.* FROM Orders a JOIN Customers b ON [Link] = [Link];
Cloud & Azure

41. What is Azure?


Answer: Microsoft’s cloud platform offering IaaS, PaaS, SaaS.

42. Compare IaaS, PaaS, SaaS.


Answer:

Aspect IaaS (Infrastructure) PaaS (Platform) SaaS (Software)

Highest (manage OS, apps, Medium (manage None (use ready-made


Control
data) apps/data only) software)

User manages OS, patches, Provider manages Provider manages


Maintenance
security OS/runtime everything

Scalability Manual scaling Auto-scaling built-in Auto-scaling built-in

Pay for platform


Cost Pay for VMs/storage Pay per user/license
resources

Migrating legacy apps to Ready-to-use apps (e.g.,


Use Case Developing new apps
cloud email)

Azure App Service, Gmail, Office 365,


Examples AWS EC2, Azure VMs
Heroku Salesforce

Analogy:
• IaaS: Renting a plot of land (build anything, but maintain it).
• PaaS: Renting a furnished apartment (just move in your stuff).
• SaaS: Staying in a hotel (everything is managed for you).

43. List Azure storage types.


Answer: Blob, Table, Queue, File, Disk.

44. Explain Azure storage tiers.


Answer: Hot (frequent access), Cool (infrequent), Cold (rare), Archive (long-term).

45. What is Azure Scheduler?


Answer: Service to automate job execution at defined times.

46. Why is Azure Diagnostic API needed?


Answer: To monitor and collect logs from Azure resources (e.g., VM metrics).
47. Define SLA.
Answer: Service Level Agreement guaranteeing uptime (e.g., 99.9%).

48. What is Azure Blob Storage?


Answer: Object storage for unstructured data (images, videos).

49. What is a role instance in Azure?


Answer: A VM instance running a web/worker role in Cloud Services.

50. What will you do during a drive failure in Azure?


Answer: Use Azure Managed Disks with automatic replication for fault tolerance.

51. What is cloud computing?


Answer: On-demand delivery of IT resources (servers, storage, apps) over the internet.

52. Name cloud deployment models.


Answer: Public (Azure/AWS), Private (on-prem), Hybrid.

Project Explanation

53. How to explain your project?


Answer: Use the STAR method:
- Situation: Problem context.
- Task: Your role.
- Action: Steps taken.
- Result: Outcomes/metrics.

Common questions

Powered by AI

IaaS (Infrastructure as a Service) provides the highest level of control, where users manage the operating system, applications, and data. It's ideal for migrating legacy applications to the cloud. An example is Azure VMs . PaaS (Platform as a Service) offers a middle ground where the user manages applications and data while the provider handles operating systems. It suits developing new applications, such as using Azure App Service . SaaS (Software as a Service) provides the least control, offering fully managed software which users can subscribe to, suited for ready-to-use applications like Gmail or Salesforce . Each service model supports varying degrees of user responsibility and customization based on the desired level of management and integration.

Azure facilitates disaster recovery and fault tolerance primarily through Managed Disks with built-in redundancy and automatic replication across different data centers, ensuring data durability and accessibility in case of hardware failures . Managed services like Azure Backup and Site Recovery offer automated backup solutions and replication of workloads to secondary locations for quick restoration, and thus play a crucial role in business continuity planning. The use of distributed cloud environments minimizes the risk associated with localized failures and allows for more robust system availability. Additionally, features like Azure's SLA commitments provide assurance of uptime and service reliability.

In OLTP environments, which focus on real-time order processing and data transactions (e.g., e-commerce orders), ETL processes are typically less intensive and may operate in near-real-time to accommodate frequent small-scale data updates . In OLAP environments, which are optimized for analytical queries, ETL processes tend to be more elaborate, tasked with extracting large batches of data, transforming it to fit analytical models, and loading it into data warehouses for complex, historical analysis . The primary change between contexts is the frequency and complexity of the ETL operations, with OLAP requiring less frequent but more complex data transformations and loading operations focused on comprehensive data aggregation and preparation for analysis.

SQL subqueries enhance data retrieval by allowing additional queries within a main query, facilitating complex data filtering and aggregation without duplicating code . Scalar subqueries return a single value, often used in expressions where a single data point influences the larger query context. Single-row subqueries return only one row with multiple columns, useful for direct comparisons or settings where multiple values are retrieved but only one row is valid for execution context . Correlated subqueries, unlike their non-correlated counterparts, depend on an outer query's data for each row and offer in-depth, row-specific data manipulation, though they may impact performance due to repetitive execution per outer query row . Understanding these types allows for tailored query design that optimizes both readability and performance.

Normalization is the process of organizing a database to minimize redundancy by splitting a database into smaller tables and defining relationships between them, typically achieving efficiencies through 1NF to 5NF . Denormalization, conversely, adds redundancy to a database to optimize read performance, commonly used in data warehouses where query performance is prioritized . While normalization is beneficial in OLTP systems for handling transactional operations with small, frequent updates and inserts, denormalization is preferred in OLAP scenarios where complex queries require fast read access to large volumes of data.

Python supports multiple inheritance, allowing a class to inherit features from more than one parent class, a flexibility not present in many languages that limit a class to a single inheritance path . Benefits include enhanced modularity and code reuse, with the ability to incorporate methods and attributes from multiple sources, creating complex and feature-rich objects easily. However, it introduces complications such as the Diamond Problem, where inheritance paths might lead to ambiguous method resolutions and increased debugging difficulty due to entangled dependencies. Python addresses some of these issues with the Method Resolution Order (MRO), maintaining a clear path using the C3 superclass linearization.

INNER JOIN returns only matching rows from both tables, often used when absolute data consistency is needed across sources, and generally the most efficient join in terms of processing time and resource usage . LEFT JOIN returns all rows from the left table and the matched rows from the right table, adding NULLs for non-matching rows, suitable for when all left-side entries are required regardless of matches . RIGHT JOIN operates similarly, but keeps all right table rows, useful for preserving right-side data integrity . FULL JOIN returns all matching records from both tables, filling unmatched areas with NULLs, often used where comprehensive data reporting is needed but can be resource-intensive due to its broad scope. Selection of join types must consider balance between data completeness and query performance.

SCD Type 1 involves overwriting old data with new, thus no historical trace is kept, and is applicable when changes are irrelevant . SCD Type 2 retains historical changes by adding a new row each time a change occurs, providing a complete timeline and is suitable for systems requiring full historical data . SCD Type 3 tracks limited changes by updating existing data often using additional columns, which is useful for scenarios where only the latest and one previous version are relevant . For a system requiring comprehensive historical accuracy, SCD Type 2 would be the best choice as it maintains full historical records of data changes over time.

Star schema is a type of data warehouse schema characterized by denormalized, highly simplified tables which include fact tables with metrics linked to dimension tables with descriptive attributes . Snowflake schema, on the other hand, involves normalized dimension tables, and is more complex due to its hierarchical layout of tables . Star schemas are often favored in environments where query performance is critical and the complexity of data relationships is low, allowing quick insights with simpler joins. Snowflake schemas might be advantageous in scenarios with more complex analytical requirements, as they reduce redundancy and can lead to more accurate data representation, albeit with potentially slower read performance due to additional joins.

Logical operators in Python ('and', 'or', 'not') are essential in control flow for making multiple conditional checks more streamlined and efficient . The 'and' operator ensures that both conditions must be true for the overall expression to evaluate true, often used in series of dependent constraints. The 'or' operator provides flexibility, allowing either condition to suffice for a true evaluation, which is handy for alternative pathways in control flow. The 'not' operator inverts boolean values, crucial for toggling between states based on condition outcomes. Understanding these operators enables concise, readable, and optimized control structures, reducing redundancy and enhancing performance by short-circuiting unnecessary evaluations.

You might also like