Back to Browse

SQL Interview Questions | Ace Your Data Analyst Interview

319 views
Jul 19, 2024
21:01

Welcome to CodeInQueries! 🖥️📈 Are you preparing for a data analyst or database developer interview? This video covers the top SQL interview questions that you need to know to ace your interview. We'll walk you through each question with detailed explanations and examples to ensure you're fully prepared. 🔹 Common SQL Questions: Get familiar with frequently asked SQL interview questions that test your foundational knowledge. 🔹 Advanced SQL Queries: Learn how to tackle complex SQL queries that interviewers often use to assess your problem-solving skills. 🔹 Performance Optimization: Understand key concepts related to query optimization and performance tuning. 🔹 Practical Examples: Work through real-world scenarios and examples to see how to apply your SQL skills effectively. 🔹 Tips and Best Practices: Gain insights and tips on presenting your answers confidently and effectively during the interview. create and insert table statements -------------------------------------------------------------------------------------------- /* Q1. find Monthly and Quaterly Sales for given data */ CREATE TABLE Sales ( SaleID INT PRIMARY KEY, SaleDate DATE, Amount DECIMAL(10, 2), ProductID INT, CustomerID INT ); -- Sample Data INSERT INTO Sales (SaleID, SaleDate, Amount, ProductID, CustomerID) VALUES (1, '2024-01-05', 100.00, 1, 101), (2, '2024-01-15', 200.00, 2, 102), (3, '2024-02-20', 150.00, 1, 103), (4, '2024-03-25', 250.00, 2, 104), (5, '2024-04-10', 300.00, 3, 105), (6, '2024-04-20', 350.00, 4, 106), (7, '2024-05-30', 400.00, 3, 107), (8, '2024-06-15', 450.00, 4, 108), (9, '2024-07-05', 500.00, 1, 109), (10, '2024-08-25', 550.00, 2, 110), (11, '2024-09-15', 600.00, 3, 111), (12, '2024-10-10', 650.00, 4, 112), (13, '2024-11-20', 700.00, 1, 113), (14, '2024-12-25', 750.00, 2, 114), (15, '2024-01-10', 180.00, 1, 115), (16, '2024-02-14', 220.00, 2, 116), (17, '2024-02-28', 130.00, 3, 117), (18, '2024-03-03', 170.00, 4, 118), (19, '2024-03-15', 210.00, 1, 119), (20, '2024-04-01', 240.00, 2, 120), (21, '2024-05-11', 290.00, 3, 121), (22, '2024-05-22', 330.00, 4, 122), (23, '2024-06-05', 370.00, 1, 123), (24, '2024-06-17', 410.00, 2, 124), (25, '2024-07-09', 450.00, 3, 125), (26, '2024-08-20', 490.00, 4, 126), (27, '2024-09-03', 530.00, 1, 127), (28, '2024-09-25', 570.00, 2, 128), (29, '2024-10-07', 610.00, 3, 129), (30, '2024-10-28', 650.00, 4, 130), (31, '2024-11-10', 690.00, 1, 131), (32, '2024-11-22', 730.00, 2, 132), (33, '2024-12-05', 770.00, 3, 133), (34, '2024-12-18', 810.00, 4, 134), (35, '2024-01-15', 160.00, 1, 135), (36, '2024-01-25', 200.00, 2, 136), (37, '2024-02-05', 250.00, 3, 137), (38, '2024-02-18', 300.00, 4, 138), (39, '2024-03-10', 350.00, 1, 139), (40, '2024-03-22', 400.00, 2, 140), (41, '2024-04-15', 450.00, 3, 141), (42, '2024-04-30', 500.00, 4, 142), (43, '2024-05-10', 550.00, 1, 143), (44, '2024-05-21', 600.00, 2, 144), (45, '2024-06-02', 650.00, 3, 145), (46, '2024-06-20', 700.00, 4, 146), (47, '2024-07-01', 750.00, 1, 147), (48, '2024-07-18', 800.00, 2, 148), (49, '2024-08-05', 850.00, 3, 149), (50, '2024-08-15', 900.00, 4, 150); /* Q2. given a input table we have to write sql query to find output */ create table person (name varchar(20), departmentid int) insert into person values ('ram',1),('shyam',1),('pintu',2), ('chintu', 3),('geeta',2),('seeta',2),('rahul',1) /* Output */ /* 1 | ram, shyam, rahul 2 | pintu, geeta, seeta 3 | chintu */ /* Q3. what is a nested windows function in sql server */ /* find running sum of sales for each product and assign a rank of running sum sales column in desc order */ /* Q4. SQL Query to Find Salary-wise Rank for Each Employee in the IT Department in UP */ CREATE TABLE Employee ( EmployeeID INT PRIMARY KEY, Department VARCHAR(50), State VARCHAR(50), Salary DECIMAL(10, 2), Name VARCHAR(100), Position VARCHAR(100) ); -- Sample Data INSERT INTO Employee (EmployeeID, Department, State, Salary, Name, Position) VALUES (1, 'IT', 'UP', 60000, 'John Doe', 'Developer'), (2, 'HR', 'UP', 50000, 'Jane Smith', 'Manager'), (3, 'IT', 'UP', 70000, 'Sam Brown', 'Analyst'), (4, 'Finance', 'UP', 80000, 'Lisa White', 'Accountant'), (5, 'IT', 'UP', 65000, 'Chris Green', 'Developer'), (6, 'IT', 'MH', 60000, 'Alex Black', 'Analyst'), (7, 'HR', 'MH', 55000, 'Patricia Adams', 'Coordinator'), (8, 'IT', 'UP', 75000, 'Tom Clark', 'Manager'), (9, 'IT', 'UP', 50000, 'Eva Davis', 'Support'), (10, 'Finance', 'MH', 85000, 'James Wilson', 'CFO'); -------------------------------------------------------------------------------------------- Subscribe to CodeInQueries for more tutorials, interview prep guides, and projects on SQL, data analysis, and programming! 🔔 Don't forget to hit the bell icon to stay updated with our latest content! 👍 Like, comment, and share if you found this video helpful. 📢 Follow us on social media: Instagram - @codeinqueries 💬 Join the conversation and share your thoughts in the comments below!

Download

0 formats

No download links available.

SQL Interview Questions | Ace Your Data Analyst Interview | NatokHD