Skip to main content

Questions tagged [exists]

Filter by
Sorted by
Tagged with
0 votes
2 answers
55 views

I have a table with below structure: create table TEST_REFUND_CASHOUT ( f_gdate DATE, trackingcode VARCHAR2(4000), cashout_trackingcode VARCHAR2(4000), cashout_date ...
Pantea's user avatar
  • 1,502
0 votes
1 answer
1k views

I've been told that when checking for the existence of a row in a table, this will work: EXISTS(SELECT 1 FROM....) but that a "better" way in regards to speed performance of the query would ...
Gharbad The Weak's user avatar
0 votes
2 answers
239 views

Given the following database: CREATE TABLE "Activity" ( "id" INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, "designation" TEXT NOT NULL ); CREATE ...
Exprove's user avatar
  • 109
0 votes
1 answer
165 views

Say I have below table cis aid cid apid ntime buid flg jid 30 1208 229067737 1026 9 DDDD400C 0 0 30 1209 229067737 1026 11 DDDD400C 0 0 30 0 229067737 1026 12 DDDD400C 1 100 30 1210 229067737 1026 13 ...
Himanshuman's user avatar
0 votes
2 answers
83 views

I currently have two tournaments that have matches. Wimbledon and Atlanta open which I have one as a grand slam and the other as a masters 1000, and I want to get the players who played in both This ...
zaria palmer's user avatar
5 votes
2 answers
509 views

I'm trying to perform a common task, deleting duplicates from a table with the aim of adding a unique constraint. CREATE TABLE IF NOT EXISTS item_identifier ( pk BIGSERIAL PRIMARY KEY, ...
Joe's user avatar
  • 1,665
6 votes
1 answer
1k views

Faced weird behaviour with EXISTS (also applies for NOT EXISTS) generating different execution plans for WHERE EXISTS(...) EXPLAIN ANALYZE SELECT * FROM books WHERE EXISTS (SELECT 1 FROM authors WHERE ...
scorpp's user avatar
  • 173
2 votes
2 answers
3k views

I have a queue system that has two tables, jobs and jobs_queues. jobs is where we put jobs to run and job_queues we populate with queue names so that when we pick jobs we can discard those that are ...
William Oliveira's user avatar
-1 votes
2 answers
143 views

I have two tables with 1 identical data column for comparison. One table "species" is a wide list of species and each data row has one unique id called "suid" add. to its primary ...
BigMac's user avatar
  • 1
4 votes
3 answers
19k views

The below is a valid TSQL statement. But I want to understand how SQL Server processes it. DELETE A FROM table1 WITH (NOLOCK) WHERE EXISTS ( SELECT 1 FROM table2 B WITH (NOLOCK)...
a_shie's user avatar
  • 41
0 votes
2 answers
4k views

Normally, to check existence in Oracle I will do: SELECT COUNT(1) FROM foo WHERE bar = 'baz' However, if the foo table contains multiple rows where bar='baz', this query needlessly scans through the ...
Matthew Moisen's user avatar
0 votes
1 answer
107 views

I have a large table (TableA) with approx. 120 mio. datasets. This table contains a single primary key column (type: int). Another large table (TableB) contains the same ID column with some other ...
Tom L.'s user avatar
  • 103
3 votes
1 answer
63 views

I hope that someone can help me. I need to search to filter out values in a database. The database has about 14 000 records of Koalas that have come into care. Each Koala has their own name with a ...
Rod-Miller's user avatar
4 votes
2 answers
5k views

Did a switch to a WHERE EXISTS in temp table (Object13 in the plans) from an INNER JOIN to said temp table in final select in procedure. Logical reads plummeted, but plan cost and memory ...
BBaggins's user avatar
-1 votes
1 answer
41 views

I have a table bills having columns id, starting_bl_no, ending_bl_no. How can I check a new bill number input is already exist in the table? id starting_bl_no ending_bl_no 1 100 ...
Navaneet Raman Bhaskar's user avatar
1 vote
1 answer
227 views

I have db and I am trying to create table called "sales_invoice_grid" I am having bellow scenarios: error 1: while creating the table "sales_invoice_grid" manually, it gives the message that it ...
1990rk4's user avatar
  • 111
1 vote
1 answer
209 views

I am comparing two tables on different Servers and the query I am running looks like this: Select top 100 * From [ServerA].[MyDB].[dbo].[Table1] Where Exists( Select * from [ServerB].[TheirDB].[...
levi Clouser's user avatar
1 vote
2 answers
114 views

select * from orders o WHERE EXISTS ( select 1 from orders o2 where o2.EmployeeID = o.EmployeeID AND YEAR(o2.OrderDate) = 1997 and MONTH(o2.OrderDate) = 9 AND DAY(o2....
andriij's user avatar
  • 13
0 votes
1 answer
308 views

once again, I come here for your rescue. how can I improve a query like this for a table with 20 million rows? I'm trying to update a table, by using the date and getting the first date of ...
edoyak's user avatar
  • 1
9 votes
3 answers
60k views

Lets take an array of ids of size n in the application level. for instance [132,3425,13,13,... 392] where n is bigger than 100k entries. Some of this entries are repeated. I need to check if all of ...
Daniel Santos's user avatar
11 votes
1 answer
36k views

I have made a backup of my specific tables that I want to restore into a new database using: call pg_dump -Fc -h server -d database -U user -p password -v -f dump.sql -t public.table1 -t public....
Ian23's user avatar
  • 113
3 votes
0 answers
188 views

Is there any potential problem in using (in a transaction) SELECT EXISTS( SELECT * FROM mytable WHERE id=36 FOR UPDATE ) i.e. having SELECT ... FOR UPDATE within an EXISTS? MySQL does certainly some ...
Déjà vu's user avatar
  • 555
5 votes
1 answer
577 views

The query below is very slow (running over a minute) and I have narrowed down the issue to the OR operator (...OR (EXISTS (SELECT...). I used live execution to verify that there is a nested loop join ...
miledba's user avatar
  • 105
21 votes
3 answers
14k views

I have the below query : select databasename from somedb.dbo.bigtable l where databasename ='someval' and source <>'kt' and not exists(select 1 from dbo.smalltable c where c.source=l.source) ...
TheGameiswar's user avatar
  • 3,009
0 votes
1 answer
53 views

I'm trying to generate a list of data which is on completed status but has not been billed. I am able to produce a list of all completed orders however i am unable to remove the ones which have been ...
Jamie's user avatar
  • 3