LinkedIn SQL Interview Question | Using CTEs | Advanced SQL

Поділитися
Вставка
  • Опубліковано 5 лис 2024

КОМЕНТАРІ • 19

  • @dharmiklingam1108
    @dharmiklingam1108 2 місяці тому

    Hi Nishtha i hpoe you doing good,it will helpful for people if you provide the script in every video.

  • @sachins5660
    @sachins5660 2 місяці тому

    wow linkedln is asking such simple question and someone made a video on this.

  • @prajju8114
    @prajju8114 2 місяці тому

    with cte_job as(
    Select company_id, title, description, row_number() over(partition by company_id order by job_id) as job_count from job_listings
    )
    Select count(distinct company_id) as duplicate_companies from cte_job where job_count>1
    This is also giving same result

  • @rashmikakrishnaswamy4926
    @rashmikakrishnaswamy4926 13 днів тому

    How to group description column when it is defined as text datatype? it throws error

  • @JeevanC-l3k
    @JeevanC-l3k 2 місяці тому

    with cte as(
    select
    company_id,
    title,
    description,
    count(*) over(partition by company_id, title) as counts
    from job_listings
    )
    select
    count(distinct company_id) as duplicate_companies
    from cte
    where counts > 1;

  • @theinsightminer08
    @theinsightminer08 21 день тому

    SELECT COUNT(DISTINCT company_id) AS duplicate_companies
    FROM
    (
    SELECT
    company_id,
    COUNT(*) OVER(PARTITION BY company_id,title,description) as cnt
    FROM job_listings
    )
    WHERE cnt>1 ;

  • @Team_Kanya_raasi
    @Team_Kanya_raasi Місяць тому

    my approach ;
    select job_id,title,count(company_id)as Duplicate_jobid from(
    select * , ROW_NUMBER() over (partition by company_id order by job_id) as ranking from
    job_listings
    ) x
    where ranking = 2
    group by job_id,title
    correct me if i'm wrong
    thanks

  • @durgaprasadbammidi7425
    @durgaprasadbammidi7425 2 місяці тому +1

    I think the question is not correctly framed

  • @ajeetadarsh2871
    @ajeetadarsh2871 2 місяці тому

    How to fetch previous date using today's date?

    • @sonujack1
      @sonujack1 2 місяці тому

      You can use lag function.
      Select name, dates, lag(dates) over ( order by dates) as previous_dates from table_x

  • @rohitsingh3964
    @rohitsingh3964 2 місяці тому

    can you learn me sql, if yes please share class time and fees.

  • @architsrivastava6649
    @architsrivastava6649 2 місяці тому

    Select count( Distinct company_id) as duplicate_companies
    from(
    Select *,
    row_number() over(partition by company_id, title, description order by company_id) as rn
    from job_listings) x
    where rn>1
    group by company_id;

  • @tanujreddy8597
    @tanujreddy8597 Місяць тому

    SELECT
    count(c)
    FROM
    (
    SELECT
    company_id,
    description,
    COUNT(*) c
    FROM
    job_listing
    GROUP BY
    company_id,
    description
    HAVING
    COUNT(*) > 1
    );

  • @harshitsalecha221
    @harshitsalecha221 2 місяці тому

    WITH cte1 AS (SELECT *,ROW_NUMBER() OVER(PARTITION BY company_id) as rn FROM job_listings)
    SELECT c1.company_id
    FROM cte1 as c1
    INNER JOIN cte1 as c2
    ON c1.company_id=c2.company_id AND c1.title=c2.title AND c1.description=c2.description AND c1.rn

  • @HARSHRAJ-wz2rp
    @HARSHRAJ-wz2rp 2 місяці тому

    with cte as(
    select job_listings.*,ROW_NUMBER()OVER(PARTITION BY company_id) as x1 FROM job_listings
    )
    select COUNT(DISTINCT company_id) as duplicate_companies FROM cte where x1>1;
    Nishtha man it is request to you that if you found my solution as a right solution,plese give some reaction on my comment