cookie

Мы используем файлы cookie для улучшения сервиса. Нажав кнопку «Принять все», вы соглашаетесь с использованием cookies.

avatar

Data Analysts

Perfect channel to learn Data Analytics Learn SQL, Python, Alteryx, Tableau, Power BI and many more For Promotions: @coderfun Buy ads: https://telega.io/c/sqlspecialist

Больше
avatarNetwork:Data AnalystsСтрана не указанаАнглийский8 302Технологии и приложения1 352
Рекламные посты
55 457
Подписчики
+8924 часа
+1 0847 дней
+4 72230 дней

Загрузка данных...

Прирост подписчиков

Загрузка данных...

SQL INTERVIEW PREPARATION PART-8 How can you find the second highest salary in a table without using the LIMIT clause? You can use a subquery to find the maximum salary that is less than the overall maximum salary. Example:
SELECT MAX(salary)
FROM employees
WHERE salary < (SELECT MAX(salary) FROM employees);
Tip: Explain that this approach can be useful when the LIMIT clause is not supported or if you want to demonstrate proficiency in using subqueries. Share with credits: https://t.me/sqlspecialist Like this post if you want me to continue SQL Interview Preparation Series 👍❤️ Hope it helps :)
Показать все...
👍 11
SQL INTERVIEW PREPARATION PART-8 How do you find the nth highest salary from a table in SQL? Answer: You can use the LIMIT clause in combination with the ORDER BY clause to find the nth highest salary. Example:
SELECT DISTINCT salary
FROM employees
ORDER BY salary DESC
LIMIT n-1, 1;
Replace 'n' with the desired rank of the salary. Tip: Emphasize the importance of using DISTINCT to handle cases where there are duplicate salaries, and ensure the ORDER BY clause is sorting the salaries in descending order to find the nth highest salary. Share with credits: https://t.me/sqlspecialist Like this post if you want me to continue SQL Interview Preparation Series 👍❤️ Hope it helps :)
Показать все...
👍 17 5
SQL INTERVIEW PREPARATION PART-7 Explain the difference between GROUP BY and ORDER BY in SQL. - GROUP BY: Groups rows that have the same values into summary rows. - ORDER BY: Sorts the result set in ascending or descending order based on one or more columns. Tips: - Mention that GROUP BY is typically used with aggregate functions like COUNT, SUM, AVG, etc., while ORDER BY is used for sorting the result set. - Provide an example to illustrate the distinction between the two clauses. Share with credits: https://t.me/sqlspecialist Like this post if you want me to continue SQL Interview Preparation Series 👍❤️ Hope it helps :)
Показать все...
👍 27 1
SQL INTERVIEW PREPARATION PART-6 Let's discuss about subquery today - A subquery, also known as an inner query or nested query, is a query within another SQL query. It is used to provide data to the main query (outer query). Subqueries can be used in various clauses such as SELECT, FROM, WHERE, and HAVING. Types of Subqueries: - Single-row subquery: Returns a single row and is used with operators like =, <, >. - Multi-row subquery: Returns multiple rows and is used with operators like IN, ANY, ALL. - Correlated subquery: A subquery that references columns from the outer query. It is evaluated once for each row processed by the outer query. Examples: - Single-row subquery:
     SELECT name
     FROM employees
     WHERE department_id = (SELECT id FROM departments WHERE department_name = 'Sales');
     
- Multi-row subquery:
     SELECT name
     FROM employees
     WHERE department_id IN (SELECT id FROM departments WHERE region = 'North');
     
- Correlated subquery:
     SELECT e.name
     FROM employees e
     WHERE e.salary > (SELECT AVG(salary) FROM employees WHERE department_id = e.department_id);
     
Go though SQL Learning Series to refresh your basics Share with credits: https://t.me/sqlspecialist Like this post if you want me to continue SQL Interview Preparation Series 👍❤️ Hope it helps :)
Показать все...
👍 28 1
SQL INTERVIEW PREPARATION PART-5 Let's discuss about normalization today    - Normalization is the process of organizing the data in a database to reduce redundancy and improve data integrity. The goal is to divide a database into two or more tables and define relationships between them to reduce redundancy and dependency. There are several normal forms, each with specific rules to help achieve this goal. Normalization involves multiple steps, usually referred to as "normal forms" (NFs):    - First Normal Form (1NF): Ensures that the table has a primary key and that each column contains atomic (indivisible) values.      - Example:       
       CREATE TABLE customers (
           customer_id INT PRIMARY KEY,
           customer_name VARCHAR(100),
           contact_number VARCHAR(15)
       );
       
   - Second Normal Form (2NF): Achieves 1NF and ensures that all non-key attributes are fully functionally dependent on the primary key. This means removing partial dependencies of any column on the primary key.      - Example: If a table has a composite key (e.g., order_id, product_id) and some columns depend only on part of that key, those columns should be moved to another table.    - Third Normal Form (3NF): Achieves 2NF and ensures that all the attributes are functionally dependent only on the primary key. This eliminates transitive dependencies.      - Example:       
       CREATE TABLE orders (
           order_id INT PRIMARY KEY,
           customer_id INT,
           order_date DATE,
           FOREIGN KEY (customer_id) REFERENCES customers(customer_id)
       );

       CREATE TABLE order_details (
           order_id INT,
           product_id INT,
           quantity INT,
           PRIMARY KEY (order_id, product_id),
           FOREIGN KEY (order_id) REFERENCES orders(order_id)
       );
       
   - Boyce-Codd Normal Form (BCNF): A stricter version of 3NF where every determinant is a candidate key. This addresses situations where 3NF is not sufficient to eliminate all redundancies. Tricky Question:    - How would you approach normalizing a table that contains repeating groups of data?      - This question tests the understanding of the concept of atomicity and the process of transforming a table into 1NF. Example Answer:    - "If a table contains repeating groups, such as multiple phone numbers in one column separated by commas, I would first ensure that each piece of data is atomic. I would create a separate table for the repeating group and link it with a foreign key to the original table, thereby normalizing the data into 1NF." Go though SQL Learning Series to refresh your basics Share with credits: https://t.me/sqlspecialist Like this post if you want me to continue SQL Interview Preparation Series 👍❤️ Hope it helps :)
Показать все...
👍 28 6🔥 1
SQL INTERVIEW PREPARATION PART-4 What is the difference between INNER JOIN and OUTER JOIN? - INNER JOIN: Returns only the rows where there is a match in both tables. - OUTER JOIN: Returns the matched rows as well as unmatched rows from one or both tables. There are three types of OUTER JOIN: - LEFT OUTER JOIN (or LEFT JOIN): Returns all rows from the left table, and the matched rows from the right table. If no match is found, the result is NULL on the right side. - RIGHT OUTER JOIN (or RIGHT JOIN): Returns all rows from the right table, and the matched rows from the left table. If no match is found, the result is NULL on the left side. - FULL OUTER JOIN: Returns rows when there is a match in one of the tables. This means it returns all rows from the left table and the right table, filling in NULLs when there is no match. Examples: - INNER JOIN:
     SELECT employees.name, departments.department_name
     FROM employees
     INNER JOIN departments ON employees.department_id = departments.id;
     
- LEFT JOIN:
     SELECT employees.name, departments.department_name
     FROM employees
     LEFT JOIN departments ON employees.department_id = departments.id;
     
- RIGHT JOIN:
     SELECT employees.name, departments.department_name
     FROM employees
     RIGHT JOIN departments ON employees.department_id = departments.id;
     
- FULL OUTER JOIN:
     SELECT employees.name, departments.department_name
     FROM employees
     FULL OUTER JOIN departments ON employees.department_id = departments.id;
     
Go though SQL Learning Series to refresh your basics Share with credits: https://t.me/sqlspecialist Like this post if you want me to continue SQL Interview Preparation Series 👍❤️ Hope it helps :)
Показать все...
👍 32 11🥰 4
SQL INTERVIEW PREPARATION PART-3 What are the different types of SQL commands? SQL commands can be categorized into several types based on their functionality: - DDL (Data Definition Language): These commands are used to define and modify database structures, such as tables and indexes. - Examples: CREATE, ALTER, DROP - Example:
         CREATE TABLE employees (
             id INT PRIMARY KEY,
             name VARCHAR(100),
             position VARCHAR(50)
         );
         
- DML (Data Manipulation Language): These commands are used to manipulate the data within the database. - Examples: SELECT, INSERT, UPDATE, DELETE - Example:
         INSERT INTO employees (id, name, position) VALUES (1, 'John Doe', 'Manager');
         
- DCL (Data Control Language): These commands are used to control access to data within the database. - Examples: GRANT, REVOKE - Example:
         GRANT SELECT ON employees TO user_name;
         
- TCL (Transaction Control Language): These commands are used to manage transactions in the database. - Examples: COMMIT, ROLLBACK, SAVEPOINT - Example:
         BEGIN;
         UPDATE employees SET position = 'Senior Manager' WHERE id = 1;
         COMMIT;
         
Share with credits: https://t.me/sqlspecialist Like this post if you want me to continue SQL Interview Preparation Series 👍❤️ Hope it helps :)
Показать все...
👍 39 13
SQL Interview Preparation Part-2 How to use window functions and CTEs to solve SQL interview questions? 1. Common Table Expressions (CTEs): CTEs are temporary result sets that you can reference within a SELECT, INSERT, UPDATE, or DELETE statement. They help break down complex queries and improve readability. Syntax:
WITH cte_name AS (
    SELECT column1, column2
    FROM table_name
    WHERE condition
)
SELECT column1, column2
FROM cte_name
WHERE another_condition;
Example Problem: Find the top 3 highest-paid employees in each department. Solution Using CTE:
WITH RankedSalaries AS (
    SELECT 
        employee_id, 
        department_id, 
        salary,
        ROW_NUMBER() OVER (PARTITION BY department_id ORDER BY salary DESC) AS rank
    FROM employees
)
SELECT 
    employee_id, 
    department_id, 
    salary
FROM RankedSalaries
WHERE rank <= 3;
2. Window Functions: Window functions perform calculations across a set of table rows related to the current row. They do not reduce the number of rows returned. Common Window Functions: - ROW_NUMBER(): Assigns a unique number to each row within the partition. - RANK(): Assigns a rank to each row within the partition, with gaps in ranking for ties. - DENSE_RANK(): Similar to RANK(), but without gaps. - SUM(), AVG(), COUNT(), etc., over a partition. Syntax:
SELECT column1, 
       column2, 
       window_function() OVER (PARTITION BY column1 ORDER BY column2) AS window_column
FROM table_name;
Example Problem: Calculate the running total of sales for each salesperson. Solution Using Window Function:
SELECT 
    salesperson_id, 
    sale_date, 
    amount,
    SUM(amount) OVER (PARTITION BY salesperson_id ORDER BY sale_date) AS running_total
FROM sales;
Combining CTEs and Window Functions: Example Problem: Find the cumulative sales per department and the rank of each employee within their department based on their sales. Solution:
WITH DepartmentSales AS (
    SELECT 
        department_id, 
        employee_id, 
        SUM(sales_amount) AS total_sales
    FROM sales
    GROUP BY department_id, employee_id
),
RankedSales AS (
    SELECT 
        department_id, 
        employee_id, 
        total_sales,
        RANK() OVER (PARTITION BY department_id ORDER BY total_sales DESC) AS sales_rank
    FROM DepartmentSales
)
SELECT 
    department_id, 
    employee_id, 
    total_sales,
    sales_rank,
    SUM(total_sales) OVER (PARTITION BY department_id ORDER BY sales_rank) AS cumulative_sales
FROM RankedSales;
For those of you who are new to this channel read SQL Basics before going through advanced concepts 😄 Part-1: https://t.me/sqlspecialist/558 Share with credits: https://t.me/sqlspecialist Like this post if you want me to continue SQL Interview Preparation Series 👍❤️ Hope it helps :)
Показать все...
👍 51 12🔥 4
Requirements for data analyst role based on some jobs from @jobs_sql 👉 Must be proficient in writing complex SQL Queries. 👉 Understand business requirements in BI context and design data models to transform raw data into meaningful insights. 👉 Connecting data sources, importing data, and transforming data for Business intelligence. 👉 Strong working knowledge in Excel and visualization tools like PowerBI, Tableau or QlikView 👉 Developing visual reports, KPI scorecards, and dashboards using Power BI desktop. Nowadays, recruiters primary focus on SQL & BI skills for data analyst roles. So try practicing SQL & create some BI projects using Tableau or Power BI. You can refer our Power BI & SQL Series to understand the essential concepts. Here are some essential telegram channels with important resources: ❯ SQL ➟ t.me/sqlanalyst ❯ Power BI ➟ t.me/PowerBI_analyst ❯ Resources ➟ @learndataanalysis I am planning to come up with interview series as well to share some essential questions based on my experience in data analytics field. Like this post if you want me to start the interview series 👍❤️ Hope it helps :)
Показать все...
👍 51 10👏 2
Getting too low response on tableau learning series, do you want me to continue it?Anonymous voting
  • No, please start with any other topic
  • Yes, please finish tableau learning series
0 votes