{ "data": { "question": { "questionId": "196", "questionFrontendId": "196", "boundTopicId": null, "title": "Delete Duplicate Emails", "titleSlug": "delete-duplicate-emails", "content": "<p>Table: <code>Person</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| id | int |\n| email | varchar |\n+-------------+---------+\nid is the primary key column for this table.\nEach row of this table contains an email. The emails will not contain uppercase letters.\n</pre>\n\n<p> </p>\n\n<p>Write an SQL query to <strong>delete</strong> all the duplicate emails, keeping only one unique email with the smallest <code>id</code>. Note that you are supposed to write a <code>DELETE</code> statement and not a <code>SELECT</code> one.</p>\n\n<p>Return the result table in <strong>any order</strong>.</p>\n\n<p>The query result format is in the following example.</p>\n\n<p> </p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nPerson table:\n+----+------------------+\n| id | email |\n+----+------------------+\n| 1 | john@example.com |\n| 2 | bob@example.com |\n| 3 | john@example.com |\n+----+------------------+\n<strong>Output:</strong> \n+----+------------------+\n| id | email |\n+----+------------------+\n| 1 | john@example.com |\n| 2 | bob@example.com |\n+----+------------------+\n<strong>Explanation:</strong> john@example.com is repeated two times. We keep the row with the smallest Id = 1.\n</pre>\n", "translatedTitle": null, "translatedContent": null, "isPaidOnly": false, "difficulty": "Easy", "likes": 777, "dislikes": 1250, "isLiked": null, "similarQuestions": "[]", "exampleTestcases": "{\"headers\": {\"Person\": [\"id\", \"email\"]}, \"rows\": {\"Person\": [[1, \"john@example.com\"], [2, \"bob@example.com\"], [3, \"john@example.com\"]]}}", "categoryTitle": "Database", "contributors": [], "topicTags": [ { "name": "Database", "slug": "database", "translatedName": null, "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": [ { "lang": "MySQL", "langSlug": "mysql", "code": "# Please write a DELETE statement and DO NOT write a SELECT statement.\n# Write your MySQL query statement below\n", "__typename": "CodeSnippetNode" }, { "lang": "MS SQL Server", "langSlug": "mssql", "code": "/* \n Please write a DELETE statement and DO NOT write a SELECT statement.\n Write your T-SQL query statement below\n */\n", "__typename": "CodeSnippetNode" }, { "lang": "Oracle", "langSlug": "oraclesql", "code": "/*\n Please write a DELETE statement and DO NOT write a SELECT statement.\n Write your PL/SQL query statement below\n */\n", "__typename": "CodeSnippetNode" } ], "stats": "{\"totalAccepted\": \"205.6K\", \"totalSubmission\": \"400.3K\", \"totalAcceptedRaw\": 205553, \"totalSubmissionRaw\": 400288, \"acRate\": \"51.4%\"}", "hints": [], "solution": { "id": "210", "canSeeDetail": true, "paidOnly": false, "hasVideoSolution": false, "paidOnlyVideo": true, "__typename": "ArticleNode" }, "status": null, "sampleTestCase": "{\"headers\": {\"Person\": [\"id\", \"email\"]}, \"rows\": {\"Person\": [[1, \"john@example.com\"], [2, \"bob@example.com\"], [3, \"john@example.com\"]]}}", "metaData": "{\n \"mysql\": [\n \"Create table If Not Exists Person (Id int, Email varchar(255))\"\n ],\n \"mssql\": [\n \"Create table Person (Id int, Email varchar(255))\"\n ],\n \"oraclesql\": [\n \"Create table Person (Id int, Email varchar(255))\"\n ],\n \"database\": true,\n \"manual\": true\n}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "Create table If Not Exists Person (Id int, Email varchar(255))", "Truncate table Person", "insert into Person (id, email) values ('1', 'john@example.com')", "insert into Person (id, email) values ('2', 'bob@example.com')", "insert into Person (id, email) values ('3', 'john@example.com')" ], "enableRunCode": true, "enableTestMode": false, "enableDebugger": false, "envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"]}", "libraryUrl": null, "adminUrl": null, "challengeQuestion": null, "__typename": "QuestionNode" } } }