Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Monday, 20 September 2021

SQL query to find and delete duplicate records

Best database practice is to have a unique constraint such as a primary key on tables to prevent duplicate records, but there are some situations in which we may found ourselves working on a dataset with duplicate records and we may also need to remove or delete those records when needed.

There are many ways using which we can find duplicate records, the best approach is to find the duplicate records using ROWID.

Below is the SQL query to find and delete the duplicate records.

Saturday, 26 November 2016

How to create a XMLTYPE data type in Oracle

XMLTYPE in Oracle

XMLTYPE is a data type in oracle. Oracle has made this data type for storing the XML message, this data type is made up of CLOB which can store XML data.

Let us check how to use XMLTYPE.
1)   Creating table column using XMLTYPE
CREATE TABLE XMLTEST2
(ID NUMBER,
XMLDATA XMLTYPE,
NAME VARCHAR2(50)
);