Questions tagged [sql-delete]
The SQL DELETE statement allows you to delete a single row or multiple rows from a SQL table.
3,098
questions
-4
votes
0
answers
68
views
DELETE VALUES FROM 2 tabels
delete values from 1 table using values from 2 table
tes testt
name id stock name id stock
carrot 1 100 carrot 1 ...
0
votes
1
answer
23
views
Function to DELETE rows taking the parameters in sql query
I want create a function which removes rows and returns true if there are no errors:
CREATE OR REPLACE FUNCTION s_grnplm_tt.sp_del_stts_cd(num text, package_name text, stts_cd text)
returns ...
-1
votes
0
answers
44
views
How to delete all the duplicate rows in SQL Server including the original one [duplicate]
How to delete all the duplicate rows in SQL Server including the original one.
I see lot of ways where you can delete duplicate rows in SQL Server. However, in the end there is always one original row ...
0
votes
1
answer
32
views
Error Code: 1241. Operand should contain 1 column(s) when delete duplicate
delete from dupp
where empno in (select empno,count() from dupp
group by empno
having count()>1)
Error Code: 1241. Operand should contain 1 column(s)
what can i do to slove this ??/
i want to ...
0
votes
1
answer
35
views
Clickhouse cluster replicas sync completion time issue
I'm trying to remove about 50 milliong of 40 billions rows table (one specific day based on event_date column) , I'm using lightweight delete with "where" clause and "where" has no ...
1
vote
1
answer
23
views
Problem with mysql DELETE from multiple tables
I was using this query:
DELETE T1, T2
FROM table1 T1, table2 T2
It seems to work inconsistency in mysql.
If both tables contain rows, then all row in each are deleted, as I expected.
But if one table ...
0
votes
2
answers
75
views
Why have Postgres tables doubled in size after cancelling a DELETE?
I ran a simple delete query on a telemetries table to clear up some data but cancelled as it was taking really long. I noticed that after I cancelled the query some of the tables (all partitions of ...
1
vote
2
answers
44
views
Remove duplicates from every tables in db
I have a db with multiple tables. The tables have all the same structure with one column called date and a bunch of other columns with various data.
I can remove the duplicates from a single table as ...
2
votes
0
answers
42
views
Delete ROOM method is not working (JAVA) How i fix it?
My delete method is not working. Here the DAO:
@Dao
public interface TodoDAO {
@Insert
public void insert(Todo todo);
@Delete
public void delete(Todo todo);
@Query("SELECT * ...
0
votes
1
answer
79
views
Loop with many DELETEs not finishing even though the statements complete OK
I have a function that deletes rows from many tables, as much as 130+ tables, in a loop. The problem isn't the DELETE statements themselves, they seem to complete fine in a timely fashion, but for ...
0
votes
1
answer
63
views
Clickhouse table data deleting
I have clustered clickhouse instance and observing following behavior: when I delete data on every node of clickhouse using for example alter table db.tb on cluster cl1 delete where event_date = ...
1
vote
1
answer
35
views
Cannot seem to delete nor add to database from my php localhost
I am building a partial website with others but when I want to delete a checked item, it gives an error
"Not Found
The requested URL was not found on the server. If you entered the URL manually ...
0
votes
0
answers
55
views
On delete cascade with TOP never returns
In Azure SQL I have the following tables: orders (small) -- shipments (bigger) -- destinations (huge)
create table orders
(
id bigint not null,
constraint order_pk ...
0
votes
0
answers
35
views
Best practice to DELETE multiple rows from my SQLite table
I have a table called fingerprints. Every minute a new row is inserted. There are more tables: metadata, locations etc. where there is fingerprint_ID defined as foreging_key. These tables are huge, ...
-3
votes
1
answer
74
views
Deleting rows from a very large database with no index
We got a message from our hardware team telling us that a database is taking 1.4 TB of space alone. We looked at it and it has several tables with millions of entries of historic data (a trigger loads ...
0
votes
1
answer
17
views
How can I update a boolean column in a table with BulkOperations?
I am using an open-source library to do this. It's called SqlBulkTools.
I just want to update a column by using primary IDs to set the value to 'true' if it's being marked for deletion, rather than ...
0
votes
0
answers
29
views
How to check if delete operation was made when response is of type ResponseEntity<Void> in Spring Boot?
I'm working on a Spring Boot project and I call a method from an external service that returns an object of type ResponseEntity<Void>. This method make a delete in the database and I want to ...
0
votes
0
answers
12
views
Child entity found on SQL delete, but matching row in join table has already been deleted
I have two entities related by a @One-To-Many relation :
Entity 1 :
@Entity
@Table(name = "DemandeTravaux")
public class **DemandeTravaux** extends ObjetPersistant {
private static ...
0
votes
1
answer
18
views
How to remove the last row of a table in DolphinDB?
Is there a way to remove the last row of a table in DolphinDB?
Take the following table as an example:
t = table(1..5 as id)
How can I remove the record with id=5?
0
votes
1
answer
38
views
Want to insert the autoincrement id in Mysql in my data field via react
i have a mysql database with an autoincrement id field a data field created_on and edited_on field and i want to copy the autoincrement id from the field in my datafield aswell. my sql looks like this
...
1
vote
1
answer
83
views
Efficient approach to remove the majority of rows from a PostgreSQL table
I have a table in my Postgres database with approximately 4 million rows, and I need to reduce it to around 30,000 rows while preserving the original IDs due to foreign key references. The condition ...
0
votes
1
answer
47
views
ora-00933 sql command not properly ended delete statement
Getting the following error:
ora-00933 sql command not properly ended" error Oracle DELETE with JOIN and WHERE SQL statement.
I tried to conditionally delete records from Oracle DB table ...
0
votes
0
answers
25
views
Deleting the lowest CARD# for customers with more than one CARD# of that type
I have a customer table and I need to delete the lowest card number for a specific card number for customers who have more than one card number of that type stored. I can write a select query for it ...
0
votes
1
answer
52
views
SQL delete statement with small set of rows to delete takes very long time
I have a very basic delete statement that takes an incredible long time to execute
The code is as below
select PTRXID
into __tmpPTRXID
from PermitsTracked_Requirements_XREF
where
PermitID = ...
-1
votes
2
answers
93
views
Reduce the size of a Delete statement in BigQuery
I have the below delete statement as scheduled query and it takes ~270GB to execute. The insert statement for the same dates is much smaller.
Is there a reason that the delete statement is so big and ...
0
votes
0
answers
36
views
@ElementCollection and soft deletion using @SQLDelete and @Where
I have a structure:
@Entity
@Table(name = "parent")
@SQLDelete(sql = "UPDATE parent SET is_deleted = true WHERE id1 = ? AND id2 = ?")
@Where(clause = "is_deleted=false")
...
0
votes
1
answer
49
views
Laravel problem with delete() function from model
I want to delete a record from Categories using delete function from laravel model but this function make me a strange query that doesn't make sens. So, i got an error with (sql constraint fail) as a ...
0
votes
0
answers
144
views
Best way to handle postgres indexes on delete request?
Wondering if an index should be removed from a postgreSQL table, when a row is deleted? I am building an app and deleted many items in the process of testing the app. Now my last table row is index 20 ...
0
votes
1
answer
29
views
Delete duplicates within a group of a group [duplicate]
I have a table t_objectproperties in a MSSQL database like follows
PropertyID
ObjectID
Property
ID1
Object1
Property1
ID2
Object1
Property1
ID3
Object1
Property1
ID4
Object2
Property1
I would ...
0
votes
1
answer
37
views
I want to truncate my table once a month, otherwise it only deletes data from the past 3 months, how can I conditionally truncate or delete?
I have this variable
set is_full_refresh = (
CASE
WHEN DAY(LAST_DAY(current_date)) - DAY(current_date) < 7 AND DAYOFWEEK(current_date) = 5 THEN TRUE
ELSE FALSE END
);
And it's only true when it is ...
1
vote
1
answer
56
views
Get the physical size of data deleted?
When doing a DELETE statement, I know you can get the number of rows deleted, with @@ROWCOUNT.
Is there a way to get the size of the data deleted, in bytes?
Not something I need, but I'm just really ...
0
votes
1
answer
91
views
A delete button in Flask
The code to show the table, and also with the button to delete a row.
The code to delete the row from the table
I am trying to create a button that delete a row from a table, but I don´t know how to ...
0
votes
0
answers
21
views
Delete multiple rows from DB with Vue Js and CakePHP
I'm trying to delete a multiple rows with the same value in MySQL Server with CakePHP 2.5 and Vue Js, but continuously got an error in request.
I have next controller:
public function delete_rows($...
0
votes
0
answers
17
views
More records will make the querying slower in mongoDB using java?
I use mongoDB for my application which has huge number of data(206k) averages 10mb size of each record.
Opening the collection in mongoCompass itself take a lot of time to load.
My queries written in ...
0
votes
2
answers
56
views
Deletion of records using in condition
I need to delete records from legacy table using a reference table. Records to be deleted are around 300K and the performance is taking a hit as I'm using below query. Is there a better way to delete ...
2
votes
1
answer
64
views
How to delete values from only one table with join and where clause from other table
I need to remove data from one table but use a different table for the where clause. So I only want to remove the values I get in the output and not anything in a different table.
The table I want to ...
-2
votes
2
answers
34
views
Delete duplicates from joined table MySQL
please help me delete from the 'Component' table all records that have the same 'country' and they belong to the same 'Page', leave only one record with the country that has the newest createdAt?
...
0
votes
1
answer
57
views
NHibernate exception when creating SQL for DELETE with a condition from a JOIN
Tech Stack
SQL Server 2019, NHibernate 5.3.5, .NET Framework 4.8
Setup
Database
CREATE TABLE First (
Id UNIQUEIDENTIFIER PRIMARY KEY
);
CREATE TABLE Second (
Id UNIQUEIDENTIFIER PRIMARY KEY,
...
0
votes
0
answers
95
views
DELETE statement @ leetcode 196 Duplicate Emails
Writing an SQL query to delete all the duplicate emails, keeping only one unique email with the smallest id. We can only use DELETE here.
https://leetcode.com/problems/delete-duplicate-emails/...
0
votes
3
answers
78
views
Cascade delete in Laravel [duplicate]
I have a example of cascade delete but it looks too big and complicated, is there a way to shorten this code?
protected static function boot()
{
parent::boot();
static::...
0
votes
1
answer
97
views
How can I delete from database without the key?
I have a cart table that has cartId as the primary key, userId and itemId. I want to delete every row that has the id of a given user
Let's say this is my table:
cartId
userId
itemID
01
5
111
02
5
...
0
votes
2
answers
104
views
Merge duplicate rows to one row from 3 tables
I have found merge rows threads but nothing as complex as this. I have these 2 tables below. As you can see I have duplicates in my first table. I need to keep only one of the rows. But before I can ...
1
vote
0
answers
248
views
How to delete queue from hangfire?
Can someone help me to figure out how to delete the queue from an enqueued job in Hangfire? I deleted all the jobs from the queue but the queues are still there. I found a way to achieve this by ...
0
votes
0
answers
18
views
How can I perform both column deletion and renaming on one Google Big Query page?
id like to know if i can perform two different operations on one query page.
im trying to: delete some columns and rename another column. please how do i go about this?
p.s- im new to data analytics ...
0
votes
1
answer
71
views
How Do I solve the problem of Oracle deleting data at a specific time?
My SQL statement is as follows:
delete from "result" where DATA_DATE < TO_DATE('2023-04-06 00:00:00', 'YYYY-MM-DD HH24-MI-SS')
the error message is:
ORA-01861: literal does not match ...
0
votes
2
answers
79
views
Mariadb large deletion with join and limit
I'm trying to remove a lot of rows
My query is pretty simple but there is a JOIN and LIMIT is not allowed with that. I don't really understand why since it's not a LEFT JOIN.
I would like to wrap it ...
0
votes
0
answers
14
views
Deleting only the corresponding TARGET row in a MERGE in SSMS SQL
I have a table (DimBCAccountSchema) in SQL SSMS with the following structure:
MasterTreeKey
ParentKey
Name
LineNo
Indentation
CreateDate
UpdateDate
AuditID
22400
NULL
Other Income
530000
0
2023-05-...
-1
votes
2
answers
49
views
How to delete users who have not added card?
I have the following query:
select u.*
from users u
left join customers_cards cc
on cc.user_id = u.id
where u.belongs_to = "ezpay"
and cc.id is null
It returns users who have not added ...
0
votes
1
answer
26
views
Postgres aging out: Similar to S3 delete old tqaables after no longer touched for x days
Is there any convenience functionality for Postgres (14,15) which would delete old data i.e. similarly to S3 where data older than X days might be deleted automatically after aging off I would want to ...
1
vote
1
answer
586
views
Is it more efficient to delete rows or re-create a table on Snowflake
I have a table with 600M rows, and I want to delete a subset of those rows with ids coming from another table.
Will it be more efficient to delete the rows or re-create the table?
(Based on a ...