diff --git a/sql-queries-7/remove-duplicate-row-in-sql/identifying-duplicates.sql b/data-manipulation/remove-duplicates/identifying-duplicates.sql similarity index 100% rename from sql-queries-7/remove-duplicate-row-in-sql/identifying-duplicates.sql rename to data-manipulation/remove-duplicates/identifying-duplicates.sql diff --git a/sql-queries-7/remove-duplicate-row-in-sql/removing-duplicate-row-without-unique-identifier-setup.sql b/data-manipulation/remove-duplicates/removing-duplicate-row-without-unique-identifier-setup.sql similarity index 100% rename from sql-queries-7/remove-duplicate-row-in-sql/removing-duplicate-row-without-unique-identifier-setup.sql rename to data-manipulation/remove-duplicates/removing-duplicate-row-without-unique-identifier-setup.sql diff --git a/sql-queries-7/remove-duplicate-row-in-sql/using-internal-ctid.sql b/data-manipulation/remove-duplicates/using-internal-ctid.sql similarity index 100% rename from sql-queries-7/remove-duplicate-row-in-sql/using-internal-ctid.sql rename to data-manipulation/remove-duplicates/using-internal-ctid.sql diff --git a/sql-queries-7/remove-duplicate-row-in-sql/using-temporary-table.sql b/data-manipulation/remove-duplicates/using-temporary-table.sql similarity index 100% rename from sql-queries-7/remove-duplicate-row-in-sql/using-temporary-table.sql rename to data-manipulation/remove-duplicates/using-temporary-table.sql diff --git a/sql-queries-7/remove-duplicate-row-in-sql/removing-duplicates-in-postgresql.sql b/sql-queries-7/remove-duplicate-row-in-sql/removing-duplicates-in-postgresql.sql deleted file mode 100644 index 7332503c..00000000 --- a/sql-queries-7/remove-duplicate-row-in-sql/removing-duplicates-in-postgresql.sql +++ /dev/null @@ -1,14 +0,0 @@ -DELETE FROM Registration -USING ( - SELECT id - FROM ( - SELECT id, - ROW_NUMBER() OVER ( - PARTITION BY semester, year, course_id, student_id - ORDER BY id - ) as rn - FROM Registration - ) t - WHERE t.rn > 1 -) duplicate -WHERE Registration.id = duplicate.id; \ No newline at end of file diff --git a/sql-queries-7/remove-duplicate-row-in-sql/removing-duplicates-in-sql-server.sql b/sql-queries-7/remove-duplicate-row-in-sql/removing-duplicates-in-sql-server.sql deleted file mode 100644 index 048f5827..00000000 --- a/sql-queries-7/remove-duplicate-row-in-sql/removing-duplicates-in-sql-server.sql +++ /dev/null @@ -1,10 +0,0 @@ -WITH COUNTED_DUPLICATES AS ( - SELECT id, - ROW_NUMBER() OVER ( - PARTITION BY semester, year, course_id, student_id - ORDER BY id - ) AS row_number - FROM Registration -) -DELETE FROM CTE -WHERE row_number > 1; \ No newline at end of file diff --git a/sql-queries-7/remove-duplicate-row-in-sql/setup.sql b/sql-queries-7/remove-duplicate-row-in-sql/setup.sql deleted file mode 100644 index f5ee7cb0..00000000 --- a/sql-queries-7/remove-duplicate-row-in-sql/setup.sql +++ /dev/null @@ -1,9 +0,0 @@ -INSERT INTO Registration (id, semester, year, course_id, student_id) -VALUES - (100, 'Fall', 2021, 'CS211', 1001), - (200, 'Fall', 2021, 'CS211', 1001), - (300, 'Spring', 2022, 'CS212', 1007), - (400, 'Spring', 2022, 'CS212', 1007), - (500, 'Spring', 2022, 'CS213', 1003), - (600, 'Spring', 2022, 'CS213', 1003); - diff --git a/sql-queries-7/remove-duplicate-row-in-sql/using-groupby-and-count.sql b/sql-queries-7/remove-duplicate-row-in-sql/using-groupby-and-count.sql deleted file mode 100644 index f2099164..00000000 --- a/sql-queries-7/remove-duplicate-row-in-sql/using-groupby-and-count.sql +++ /dev/null @@ -1,4 +0,0 @@ -SELECT semester, year, course_id, student_id, COUNT(*) as count -FROM Registration -GROUP BY semester, year, course_id, student_id -HAVING COUNT(*) > 1; \ No newline at end of file diff --git a/sql-queries-7/remove-duplicate-row-in-sql/using-left-join.sql b/sql-queries-7/remove-duplicate-row-in-sql/using-left-join.sql deleted file mode 100644 index a1f1f1b6..00000000 --- a/sql-queries-7/remove-duplicate-row-in-sql/using-left-join.sql +++ /dev/null @@ -1,8 +0,0 @@ -DELETE r1 FROM Registration r1 -INNER JOIN Registration r2 -WHERE - r1.semester = r2.semester AND - r1.year = r2.year AND - r1.course_id = r2.course_id AND - r1.student_id = r2.student_id AND - r1.id > r2.id; \ No newline at end of file diff --git a/sql-queries-7/remove-duplicate-row-in-sql/using-rownumber-with-partitionby.sql b/sql-queries-7/remove-duplicate-row-in-sql/using-rownumber-with-partitionby.sql deleted file mode 100644 index 893719c3..00000000 --- a/sql-queries-7/remove-duplicate-row-in-sql/using-rownumber-with-partitionby.sql +++ /dev/null @@ -1,7 +0,0 @@ -SELECT id, semester, year, course_id, student_id, - ROW_NUMBER() OVER ( - PARTITION BY semester, year, course_id, student_id - ORDER BY id - ) AS rn -FROM - Registration; \ No newline at end of file diff --git a/sql-queries-7/remove-duplicate-row-in-sql/using-subqueries.sql b/sql-queries-7/remove-duplicate-row-in-sql/using-subqueries.sql deleted file mode 100644 index d218e58a..00000000 --- a/sql-queries-7/remove-duplicate-row-in-sql/using-subqueries.sql +++ /dev/null @@ -1,13 +0,0 @@ -DELETE FROM Registration -WHERE id IN ( - SELECT id - FROM ( - SELECT id, - ROW_NUMBER() OVER ( - PARTITION BY semester, year, course_id, student_id - ORDER BY id - ) as rn - FROM Registration - ) t - WHERE t.row_number > 1 -); \ No newline at end of file