Questions tagged [sql-delete]

The SQL DELETE statement allows you to delete a single row or multiple rows from a SQL table.

The DELETE statement removes one or more rows from a table. A subset may be defined for deletion using a condition, otherwise all rows are removed. Some DBMSs, like MySQL, allow to delete rows from multiple tables with one DELETE statement (this is sometimes called multi-table DELETE).

Use this tag instead of which is too broad.

Reference

3082 questions
0
votes
1 answer

MySQL delete query is not working as expected

I am running a query directly in MySQL Workbench. It is a work in progress, but I can't get past this issue. The query is as follows: #Temporary table to hold dcsIds that are past grace period CREATE TABLE pastGracePeriod ( dcsId varchar(50) NOT…
0
votes
1 answer

Is there any way to generate a cascade delete statement?

Let's say I have a row in Table A I wish to delete but there a multiple foreign key constraints in other tables. Is there a way to automatically generate the delete command? I think a tool that would recursively look at the foreign keys and in turn…
Matt
  • 25,943
  • 66
  • 198
  • 303
0
votes
1 answer

How to run an NHibernate SQL Delete with a final SELECT reporting completion?

Description For a project I'm working on, I'm creating a purge feature that deletes old data from this system's database. I've found that, while my SQL works correctly when ran from SQL Studio, it does not work when ran from C# code. Based on some…
Andrew Gray
  • 3,756
  • 3
  • 39
  • 75
0
votes
0 answers

How do I drop rows that is equivalent to an select statement

I have 2 tables, car and owners. I car has 0 to many owners. An owner always owns a car. I want to delete all cars that were manufactured before 2022-01-01. Consequently, deleting owners that owned cars that were manufactured before…
Zoey Malkov
  • 776
  • 6
  • 16
0
votes
1 answer

SQL Server SSIS Transaction Handling

My organization is upgrading to SQL Server 2008 from 2000 (yay!) and I am unfamiliar with the inter workings of Integration Services. I currently manage very large databases that store business process transactions that amount to between 500000 and…
Zach
  • 897
  • 1
  • 9
  • 15
0
votes
1 answer

Delete specific record from multiple child table(Not all child table) and then the parent table entry

I have a parent table name A and there are 47 child table which are referencing to this parent table A, i want to delete records from 23 child tables and then the parent table as well, and want to keep the records in the remaining child tables. I…
RT94
  • 13
  • 3
0
votes
1 answer

ignite delete row issue

I create a table user(_key(user_id,type),user_id(int),type(string),name(string), and had row,(1,"2","Scott") , then I update the row values to (2,"2","admin").and then delete the row delete from user where user_id = 2 and type = "2",sql scripts…
0
votes
0 answers

MYSQL - not distinct but eliminate

From a SELECT I get this result: u.id, c.id 101, 33 104, 57 105, 51 A UNION SELECT DISTINCT finds following records: u.id, c.id 104, 57 The final result is: u.id, c.id 101, 33 104, 57 105, 51 But I want the record from the UNION SELECT to eliminate…
0
votes
2 answers

SqLite Delete command with subquery

I have following query: SELECT * FROM ( SELECT * FROM pojmovi WHERE pojam LIKE '%og' ) WHERE pojam NOT LIKE '%olog'; This works as expected, selecting all from column pojmovi that ends in 'og' but not in 'olog', now, I want to delete those…
realitylord
  • 23
  • 1
  • 8
0
votes
0 answers

Why is the DELETE statement using psycopg is not working?

I am working on a delete request. All of my functions are working, but especially this one is not. Actually, it runs, and using my insomnia looks like the row was deleted, but when I get all rows it is still there. This belongs to my init.py from…
user17841947
0
votes
1 answer

Merge duplicate table rows than delete duplicates without timeout

I have the following (simplified) table structure: table_user_book id | book_id | user_id | page ---+---------+---------+------ 1 | b1 | c1 | 16 2 | b1 | c1 | 130 3 | b2 | c1 | 54 4 | b4 | c2 | 97 5 | b5…
hitech95
  • 55
  • 7
0
votes
2 answers

Complicated SQL for update and delete on a large table

I am having a complicated SQL problem in PostgreSQL. Suppose I have a large table called 'selling_prices'. It contains around 19 million rows. I want to remove some duplicate rows and also update some data. Here is the table…
0
votes
2 answers

sqlite DELETE (based on 2 tables) syntax (version 3.36)

I tried to delete an entry from table1 based on criteria on table2. (id in table1 is foreign key from table2) I tried all those below and all returned with syntax errors. take 1: delete table1.* from table1 inner join table2 on table1.id=table2.id…
luk
  • 1
  • 1
0
votes
1 answer

how to delete int object in django

After filtering and updating I have to delete the objscts, How to solve the isuue, AttributeError: 'int' object has no attribute 'delete' def handle(self, *args, **options): trees.objects.filter(old=True).update(new=False).delete() My…
0
votes
1 answer

After successful db2 restore, some tables might have incomplete data loaded?

Two weeks ago, I took db backup(db2 luw - 5tb) and restored it to new server. However three days ago, developer claimed that one of his table data was incompletely restored. The earliest full backup is one week ago. But all transaction log is in…
Canerc
  • 3
  • 2
1 2 3
99
100