filmov
tv
Infosys SQL Interview Question✅[ Remove Duplicate Records From Table📑In SQL ]
Показать описание
#sql #sqltips #sqlinterview #sqlinterviewquestions #infosys #removeduplicates
Hey, Everyone welcome back. So, today in this video we will learn about
How To Remove Duplicate Records From Table📑In SQL
🟢SQL QUERY USED FOR THIS VIDEO:-
---------------------------------------------------------------------------
CREATE DATABASE TEST;
USE TEST;
CREATE TABLE EMPLOYEE
(
ID Int,
FIRST_NAME varchar(50),
LAST_NAME varchar(50),
[ADDRESS] varchar(50)
);
SELECT * FROM EMPLOYEE;
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (1,'Deepan','Kumar','Odisha');
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (2,'Deepan','Kumar','Odisha');
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (3,'Deepan','Kumar','Odisha');
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (4,'Deepan','Gadkare','Odisha');
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (5,'Niraj','Patel','West_Bengal');
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (6,'Niraj','Patel','West_Bengal');
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (7,'Deepika','Naik','Keral');
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (8,'Ankita','Agarwal','UP');
SELECT * FROM EMPLOYEE;
SELECT * FROM EMPLOYEE;
DELETE FROM EMPLOYEE
WHERE ID NOT IN
(
SELECT MIN(ID) FROM EMPLOYEE
GROUP BY FIRST_NAME,LAST_NAME,[ADDRESS]
)
------------------------------------------
👋 Additional resources
-------------------------------------------
Top 100 Most Commonly Asked SQL Interview Questions and Answers [ Part-1 ] #sql
Top 100 Most Commonly Asked SQL Interview Questions and Answers [ Part-2 ] #sql
Introduction To SQL Server [ What is Database ]:-
What is DBMS || Database Management System [ In Hindi ]:-
What is RDBMS ( Relational Database Management System ):-
Database Recovery From MDF And LDF File Using GUI:-
2 Methods To Create LOGIN In SQL Server:-
How To Create a New Login/User In SQL Server:-
How To Delete/Drop LOGIN In SQL Server:-
Complete Guide For Import CSV File To #SqlServer Database (Step-By-Step Along With #ERROR & Solution;-
🔔 Subscribe to my YouTube channel:-
Social Media Link
--------------------------------
---------------------------------------------------------------------------------------------------------
Thanks for watching...
"Milestone Creator"
Hey, Everyone welcome back. So, today in this video we will learn about
How To Remove Duplicate Records From Table📑In SQL
🟢SQL QUERY USED FOR THIS VIDEO:-
---------------------------------------------------------------------------
CREATE DATABASE TEST;
USE TEST;
CREATE TABLE EMPLOYEE
(
ID Int,
FIRST_NAME varchar(50),
LAST_NAME varchar(50),
[ADDRESS] varchar(50)
);
SELECT * FROM EMPLOYEE;
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (1,'Deepan','Kumar','Odisha');
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (2,'Deepan','Kumar','Odisha');
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (3,'Deepan','Kumar','Odisha');
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (4,'Deepan','Gadkare','Odisha');
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (5,'Niraj','Patel','West_Bengal');
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (6,'Niraj','Patel','West_Bengal');
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (7,'Deepika','Naik','Keral');
INSERT INTO EMPLOYEE (ID,FIRST_NAME,LAST_NAME,[ADDRESS])VALUES (8,'Ankita','Agarwal','UP');
SELECT * FROM EMPLOYEE;
SELECT * FROM EMPLOYEE;
DELETE FROM EMPLOYEE
WHERE ID NOT IN
(
SELECT MIN(ID) FROM EMPLOYEE
GROUP BY FIRST_NAME,LAST_NAME,[ADDRESS]
)
------------------------------------------
👋 Additional resources
-------------------------------------------
Top 100 Most Commonly Asked SQL Interview Questions and Answers [ Part-1 ] #sql
Top 100 Most Commonly Asked SQL Interview Questions and Answers [ Part-2 ] #sql
Introduction To SQL Server [ What is Database ]:-
What is DBMS || Database Management System [ In Hindi ]:-
What is RDBMS ( Relational Database Management System ):-
Database Recovery From MDF And LDF File Using GUI:-
2 Methods To Create LOGIN In SQL Server:-
How To Create a New Login/User In SQL Server:-
How To Delete/Drop LOGIN In SQL Server:-
Complete Guide For Import CSV File To #SqlServer Database (Step-By-Step Along With #ERROR & Solution;-
🔔 Subscribe to my YouTube channel:-
Social Media Link
--------------------------------
---------------------------------------------------------------------------------------------------------
Thanks for watching...
"Milestone Creator"
Комментарии