sql-delete Questions

7

Solved

I am attempting to clean out a table but not get rid of the actual structure of the table. I have an id column that is auto-incrementing; I don't need to keep the ID number, but I do need it to kee...
Conspire asked 8/4, 2010 at 16:16

8

I accidentally deleted a record which is a root folder, for which the program automatically cascade deletes everything. How do I undelete accidentally deleted records?
Rebutter asked 18/1, 2009 at 10:37

7

Solved

I am not deeply acquainted with Oracle Sql Queries, therefore I face a problem on deleting some rows from a table which must fulfill a constraint which includes fields of another (joining) table. I...
Vast asked 1/10, 2012 at 11:6

6

I tried to truncate a table with foreign keys and got the message: "Cannot truncate table because it is being referenced by a FOREIGN KEY constraint". I read a lot of literature about the pro...
Dreeda asked 23/9, 2010 at 7:42

3

Solved

I'm executing a DELETE statement using the SQLite 3 C API, and I'd like to know how to fetch the number of affected rows. Unfortunately, there is no function such as sqlite3_affected_rows or simil...
Cassella asked 1/7, 2011 at 18:34

5

Solved

I am attempting to use the DELETE clause in MS Access and have an issue when also using the JOIN clause. I have notice this can be accomplished by using the DISTINCTROW key word. For example, the ...
Kapp asked 7/4, 2011 at 18:23

18

Solved

I have a table story_category in my database with corrupt entries. The next query returns the corrupt entries: SELECT * FROM story_category WHERE category_id NOT IN ( SELECT DISTINCT category.i...
Callow asked 5/9, 2008 at 10:3

9

I am trying to delete some duplicate data in my redshift table. Below is my query:- With duplicates As (Select *, ROW_NUMBER() Over (PARTITION by record_indicator Order by record_indicator) as Du...
Goatherd asked 2/6, 2016 at 3:44

3

Solved

I have collected data from an API to build a history. Initially, I saved all values every five minutes. Later, I changed my program to only save data that has changed. Now, I want to clean up my ol...
Holmes asked 20/9, 2015 at 18:10

10

Solved

I have a table in SQL Server. I would like to delete the top 1000 rows from it. However, I tried this, but I instead of just deleting the top 1000 rows it deleted all the rows in the table. Here i...
Penuchle asked 21/1, 2012 at 19:14

8

Solved

In SQL Server 2005, is there a way of deleting rows and being told how many were actually deleted? I could do a select count(*) with the same conditions, but I need this to be utterly trustworthy...
Fingerstall asked 6/10, 2008 at 12:56

6

Solved

I have a table that is supposed to keep a trace of visitors to a given profile (user id to user id pair). It turns out my SQL query was a bit off and is producing multiple pairs instead of single o...
Lucila asked 4/5, 2011 at 11:30

29

How can I delete duplicate rows where no unique row id exists? My table is col1 col2 col3 col4 col5 col6 col7 john 1 1 1 1 1 1 john 1 1 1 1 1 1 sally 2 2 2 2 2 2 sally 2 2 2 2 2 2 I want to be...
Bigamist asked 22/8, 2013 at 20:51

2

Solved

so I created a table using clickhouse, but it has duplicates in it. The following query gives me the duplicates in my table select *, count() AS cnt from my_table GROUP BY * HAVING cnt > 1 In ...
Komsomolsk asked 31/3, 2022 at 3:31

14

Solved

Is it possible to create/delete different databases in the graph database Neo4j like in MySQL? Or, at least, how to delete all nodes and relationships of an existing graph to get a clean setup for ...
Bozuwa asked 21/12, 2010 at 10:56

5

I have written a following query using CTE in Postgres. Now I am unable to delete records from it. WITH cte AS ( SELECT firstname, lastname, country, ROW_NUMBER() OVER ( PARTITION BY ...
Titustityus asked 2/3, 2021 at 7:14

3

I have a table with an auto incrementing id and a unique constraint across two columns, keycol1 and keycol2. Suppose the table has this data: H| (id, keycol1, keycol2, col1, col2) | (1, 'A', 'B', ...
Smaragdite asked 23/1, 2022 at 4:44

11

Let's say we have table Sales with 30 columns and 500,000 rows. I would like to delete 400,000 in the table (those where "toDelete='1'"). But I have a few constraints : the table is read / writt...
Goforth asked 27/6, 2012 at 15:48

11

Solved

I am a Linux admin with only basic knowledge in Mysql Queries I want to delete many table entries which are ip address from my table using id, currently i am using DELETE from tablename where ...
Derina asked 19/3, 2013 at 15:44

28

Solved

I have a table with the following fields: id (Unique) url (Unique) title company site_id Now, I need to remove rows having same title, company and site_id. One way to do it will be using the follo...
Embrocation asked 22/7, 2010 at 18:3

17

Solved

Is it possible to build a single mysql query (without variables) to remove all records from the table, except latest N (sorted by id desc)? Something like this, only it doesn't work :) delete fro...
Renie asked 23/2, 2009 at 18:58

10

Solved

I have a Postgresql database on which I want to do a few cascading deletes. However, the tables aren't set up with the ON DELETE CASCADE rule. Is there any way I can perform a delete and tell Postg...
Wyattwyche asked 24/9, 2008 at 19:19

6

Solved

Suppose I have a database with a table which contains 200k+ rows. This table has a fixed tuple with id 1800. The rest of the tuples sequence starts at 300k+. I have a need to clean this table, dele...
Hyla asked 16/1, 2013 at 19:21

5

I'm new to SQL. We have some code that should work on SQL Server 2005/2008, Oracle 10 as well as Sybase. I was writing a script to try to figure out which tables a given stored procedure modifies (...
Gibbeon asked 19/12, 2010 at 17:44

2

Solved

Having a Android Room with three tables timestamp, index, details, and all three have @PrimaryKey @ColumnInfo(name = "id") var id: Int = 0 having fun clearDataByID(idList: List<Int>) to c...
Applicable asked 2/4, 2019 at 15:31

© 2022 - 2025 — McMap. All rights reserved.