Oracle Interview question How To Get unique records without using distinct in oracle

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

КОМЕНТАРІ • 100

  • @ghousehussain5271
    @ghousehussain5271 3 роки тому +1

    Super sir you're the life saver.
    For my work i need to filter the column data. But tried with all possible options like distinct unique etc..but row_number partition worked like charm ❤️

  • @vivektarab16
    @vivektarab16 5 місяців тому

    Start
    0:09 - How to Get Records without using Unique Keyword
    1:19 - Some queries Examples
    1:43 - What do you mean by communicating a Database
    2:29 - There are Types of Sql
    3:24 - DDL
    4:40 - Truncate
    4:59 - DML
    5:36 - DCL
    6:16 - TCL
    6:49 - DRL
    7:53 - Some More Languages
    1:19 - Some queries Examples
    2:44 - Using Distinct Keyword
    2:54 - With Unique Keyword
    3:11 - Using Group by
    4:11 - Using Union
    5:19 - Union with Nulls
    6:13 - Using Intersect Operator
    6:35 - Using Minus Operator
    7:11 - Using Row_Number ()
    7:55 - Using Rank or DenseRank
    8:31 - Two more ways

  • @bharathibalakrishnan6521
    @bharathibalakrishnan6521 4 роки тому +2

    Helps to refresh and nice examples. Thank you

  • @martinsuresh5048
    @martinsuresh5048 6 років тому +1

    very helpful information hatsoff sir

  • @vivektarab16
    @vivektarab16 5 місяців тому +1

    Start
    1:19 - Some queries Examples
    2:44 - Using Distinct Keyword
    2:54 - With Unique Keyword
    3:11 - Using Group by
    4:11 - Using Union
    5:19 - Union with Nulls
    6:13 - Using Intersect Operator
    6:35 - Using Minus Operator
    7:11 - Using Row_Number ()
    7:55 - Using Rank or DenseRank
    8:31 - Two more ways - One is Using RowID - Using Subquery
    8:53 - Using RowID with Corelated Subquery
    9:11 - Recap all these Queries

  • @googdriveforme4115
    @googdriveforme4115 4 роки тому +1

    But on interview if some one asks this question reply them "there are many ways to get distinct record but using Oracle key words boost the performance so using distinct keyword is the right choice.

  • @mohanpavan6615
    @mohanpavan6615 3 роки тому +1

    Siva can you please clarify one doubt as a general, when we use 1=2 in the where clause it means it’s false and hence create or select will not be performed but in below query why is table being created but with no data? Create table emp1 as select * from emp where 1=2;

    • @himanshucharan8760
      @himanshucharan8760 2 роки тому +1

      Create will be performed but select will not return any data as this condition is false for each row in table emp.. So table emp1 will be created without any data. We do this when we want to copy only table structure without any data.

  • @TysonGill
    @TysonGill 3 роки тому

    Hi siva,
    Thanks for the video, i wanted to know the difference between distinct and unique function used here.
    Regards

  • @4ashutosh
    @4ashutosh 5 років тому +6

    We can do it using ROWID too:-
    SELECT * FROM TABLE_NAME WHERE ROWID IN (SELECT MAX(ROWID) FROM TABLE_NAME GROUP BY COLUMN_NAME)
    OR
    SELECT * FROM TABLE_NAME WHERE ROWID IN (SELECT MIN(ROWID) FROM TABLE_NAME GROUP BY COLUMN_NAME)

    • @SivaAcademy
      @SivaAcademy  5 років тому +5

      Thanks for posting the query, it may help someone whoever is reading the comments :-)

  • @mssudharshanreddy649
    @mssudharshanreddy649 5 років тому +1

    Siva sir ,
    in one of the interview i got a question like "you need to delete duplicates without using rowid or rownum.only one record should be present.duplicates should be deleted.11' how can we do this ?

    • @amit-xp2zc
      @amit-xp2zc 2 роки тому

      You. Can use group with having and in sub query use max() on serial number of the table

    • @Crazy-Trainings
      @Crazy-Trainings 5 місяців тому

      If it is full row duplication then without rowid deleting duplicate is impossible.
      Happy learning 😘

  • @abhishekraturi7842
    @abhishekraturi7842 4 роки тому

    which way is best performance wise

  • @abhilashk2534
    @abhilashk2534 3 роки тому

    Can we use join? @siva academy

  • @sudarsanrout5787
    @sudarsanrout5787 Рік тому

    Bro you are Great 👍👍

  • @ankursrivastava5148
    @ankursrivastava5148 4 роки тому

    The way in which you used to filter the unique records
    Select null,null from dual where 1=2,if we have 4 columns in the first select list,will that work ?

    • @SivaAcademy
      @SivaAcademy  4 роки тому

      The number of columns should match between select statement., otherwise query will throw error

  • @yashwani209
    @yashwani209 2 роки тому

    For the correlated query , wouldn't the count be equal to 2 when 3 rows are repeated for a particular record? Can someone explain explain please?

  • @pradipmunjamkar
    @pradipmunjamkar 3 роки тому

    Which way have better performance when working with millions of records??

  • @bharathipandian45
    @bharathipandian45 5 років тому

    Siva, at 6.09 how it works select rollno, name from emp union select null, null from dual 1=2...null is not comparable with anyvalue pls explain

    • @SivaAcademy
      @SivaAcademy  5 років тому +4

      the second query "select null, null from dual 1=2" wont return any rows, because of condition 1=2, hence the null values also not returned from the select statement, just because, the union is used, oracle tend to remove the duplicate value and sort the result.

  • @sanathkumarks8251
    @sanathkumarks8251 3 роки тому

    Hi shiv, in mysql workbench by using union keyword it is not fetching uniqe records is there any other way in mysql.

  • @vilasgaikwad4141
    @vilasgaikwad4141 5 років тому +1

    Hi Siva,
    How to find missing values of table.

    • @SivaAcademy
      @SivaAcademy  5 років тому

      @Vilas, Can you please elaborate your question with a sample data, so that its bit easy for me explain. Thanks, Siva

  • @susanjacob-w8w
    @susanjacob-w8w Рік тому

    can you recheck the correlated one, its not giving the proper output when checked in db

  • @poornimakp9835
    @poornimakp9835 4 роки тому

    Ur videos helping alot
    Thank you

  • @kumarkumar-fm5oy
    @kumarkumar-fm5oy 4 роки тому

    Thanks siva.
    I have 15k records in table .
    Can we fetch at a time using select query. I have only read access.
    Please suggest.
    Thanks.

    • @SivaAcademy
      @SivaAcademy  4 роки тому

      yes you can do.........if you want to limit the number of records, then you can use LIMIT clause as part of cursor fetch operation

  • @rahulsingh-sw3yt
    @rahulsingh-sw3yt 5 років тому +1

    Please post some video on oracle partionining

    • @SivaAcademy
      @SivaAcademy  5 років тому

      @rahul, sure, will post , please stay tuned.

    • @fkrockerzz91
      @fkrockerzz91 4 роки тому

      @@SivaAcademy Hi Siva, Have you posted anything on db partitioning?

  • @kalpeshpatil4321
    @kalpeshpatil4321 4 роки тому

    Can you please make a video on regular expression and type of regular expression with small example in easy way to get it understand.
    It will be very thankful, if you make video on this.
    Thanks in advance cheers.

    • @SivaAcademy
      @SivaAcademy  4 роки тому

      sure bro, please stay tuned, i will add into my upcoming list of videos

  • @bharathipandian45
    @bharathipandian45 5 років тому

    Hi siva, when I got this question from an interview panel, I wrote using row number analytical function, it is correct. But the panel asked why you are making life complex.... Then he told me that you would have written using rowid.. So pls suggest me when they expect me a single query from me what should I say

    • @SivaAcademy
      @SivaAcademy  5 років тому

      May be the same functionality can be implemented with out using row_number function. If that's the case try writing the same query with out using analytical functions

    • @SivaAcademy
      @SivaAcademy  5 років тому

      Can you send me the exact query they asked for, so that I can explain with more details

  • @venkatamaddina196
    @venkatamaddina196 5 років тому +1

    Very helpful. Can we get some videos on AWR report interpretation and the performance tuning tips and Partitions in Oracle

    • @SivaAcademy
      @SivaAcademy  5 років тому +1

      @Venkat, Sure bro, will cover the explain plan as part of performance tuning series soon.

  • @prashantgupta8209
    @prashantgupta8209 4 роки тому

    Hi Sir,
    How can we call URL in procedure

  • @bharathipandian45
    @bharathipandian45 5 років тому

    How developers has been categorized as beginner, intermediate, and expert is it based on years of experience we have in the domain. If it is based on years, pls give the range for each level. I have 6 years will I come under intermediate or expert

    • @SivaAcademy
      @SivaAcademy  5 років тому

      There is no strict category, however generally 0 to 4, 4 to 10, 10 + and 15+, you tipically fit into intermediate level of experience

  • @riyazbasha320
    @riyazbasha320 4 роки тому

    Excellent video sir, thank you

  • @srikanthgandhi7289
    @srikanthgandhi7289 3 роки тому

    Very informative Thanks lot

  • @mohansai9109
    @mohansai9109 4 роки тому

    Out of 9 ways. Which one has more performance sir ?

    • @SivaAcademy
      @SivaAcademy  4 роки тому

      I need to test with large volume of data, i will post a video after my analysis with numbers

  • @anushasabbavarapu5509
    @anushasabbavarapu5509 4 роки тому

    I have one table T , having 10 records with out using count function ,how we can count the records??

    • @ramalakshmi2960
      @ramalakshmi2960 3 роки тому

      Rank

    • @Kk-yn7dk
      @Kk-yn7dk 3 роки тому

      Max of rownum

    • @Crazy-Trainings
      @Crazy-Trainings 5 місяців тому

      By using case on any column is not null then 1 and Sum on then you will get.
      Happy learning😃

  • @g.sreekanthreddy1164
    @g.sreekanthreddy1164 5 років тому

    Hi Siva
    Can you pls do post videos on sql nd performance tuning?
    Thanks in advance

    • @SivaAcademy
      @SivaAcademy  5 років тому +1

      @Sreekanth, Sure, Will be posting soon, Please stay tuned.
      Thanks for your comments :-)
      Siva

  • @suyogthakare828
    @suyogthakare828 5 років тому

    Sir how to used out parameter in procedure and call these out parameter in the same procedure when we create a out mode. Sir please can you explain how this can be done

    • @SivaAcademy
      @SivaAcademy  5 років тому

      @Suyog, Can you please explain with an example, is your requirement to call the procedure with an out parameter within the same procedure?

    • @suyogthakare828
      @suyogthakare828 5 років тому

      Ya sure
      Create or replace procedure ps (e_id in number, sal out number)
      Is
      Begin
      Select salary+1000 into sal from emplyees where emp_id=e_id;
      Dbms (sal);
      End;
      /
      @filename.sql
      Exec ps (100,sal);
      When i do that it will give error for out parameter. We can not pass out mode value in procedure execution?

    • @SivaAcademy
      @SivaAcademy  5 років тому

      @SuyogYou have to decalare a local variable to get the out value,
      a sample execution method is given below for your reference, reply back to me if you need more information
      ------------------------------------------------------------------------
      SQL> set serveroutput on
      SQL>
      SQL> variable lv_num number;
      SQL> exec ps(1,:lv_num);
      PL/SQL procedure successfully completed.
      SQL> print lv_num;
      LV_NUM
      ----------
      100
      SQL>
      ------------------------------------------------------------------------

    • @suyogthakare828
      @suyogthakare828 5 років тому

      @@SivaAcademy thank you sir it working

    • @suyogthakare828
      @suyogthakare828 5 років тому

      @@SivaAcademy sir where i get the get the detail information about that

  • @Lukky2266
    @Lukky2266 Рік тому

    Nice work.

  • @swamivivekananda-cyclonicm8781
    @swamivivekananda-cyclonicm8781 2 роки тому

    UNIQUE video.

  • @leelanaresh4378
    @leelanaresh4378 3 роки тому

    Hi what is the difference between SELECT UNIQUE and SELECT DISTINCT?

    • @yashwani209
      @yashwani209 2 роки тому

      No difference at all... Same command in oracle

  • @Manojkumar-ub9bw
    @Manojkumar-ub9bw 5 місяців тому

    great video

  • @meghasingh1960
    @meghasingh1960 4 роки тому

    Informative

  • @poornimakp9835
    @poornimakp9835 4 роки тому

    How to delete parent records without deleting the child records?
    Please help with..

    • @jagadeeshdora5987
      @jagadeeshdora5987 4 роки тому +1

      I think it is not possible

    • @selvarasu5249
      @selvarasu5249 3 роки тому

      Disable foreign key constraint in child table and then delete parent record

    • @vikitech9029
      @vikitech9029 2 роки тому

      While creating the table use Delete On Cascade command....

  • @ravigoud9209
    @ravigoud9209 4 роки тому

    Great video bro.

  • @vickymore8752
    @vickymore8752 5 років тому

    Sir Please create How to delete duplicate record from table please create an video

    • @SivaAcademy
      @SivaAcademy  5 років тому

      @Vicky, Sure, I will create on duplicate record deletion using different sqls, pls stay tuned. Thanks, Siva

    • @vickymore8752
      @vickymore8752 5 років тому

      @@SivaAcademy thank you sir

  • @abhilashk2534
    @abhilashk2534 3 роки тому

    Perfect!!

  • @raju26067
    @raju26067 6 років тому

    How to delete Duplicate Records without using ROWID?

    • @SivaAcademy
      @SivaAcademy  6 років тому

      Sure, will do as soon as possible.

    • @SivaAcademy
      @SivaAcademy  6 років тому

      Will post a video on this question as soon as possible. Stay tuned.

    • @4ashutosh
      @4ashutosh 5 років тому

      DELETE FROM TABLE_NAME WHERE ROWID NOT IN (SELECT MIN(ROWID) FROM TABLE_NAME GROUP BY COLUMN_NAME)
      OR
      DELETE FROM TABLE_NAME WHERE ROWID NOT IN (SELECT MAX(ROWID) FROM TABLE_NAME GROUP BY COLUMN_NAME)

    • @kadirappaa7949
      @kadirappaa7949 4 роки тому

      @@4ashutosh As per the question, You should not use ROWID

  • @TheSushmitta
    @TheSushmitta 2 роки тому

    👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍

  • @YVB_Royal_kings
    @YVB_Royal_kings 4 роки тому

    Tq sir

  • @shubobade
    @shubobade 2 роки тому

    Anyone have duplicate record query?

  • @pradeepkadam7885
    @pradeepkadam7885 3 роки тому

    Vidio is not clear

  • @juno7893
    @juno7893 3 роки тому

    👏🏻👏🏻👏🏻