All Questions

92
votes
4answers
135421 views

Select rows which are not present in other table

I've got two postgresql tables: table name column names ----------- ------------------------ login_log ip | etc. ip_location ip | location | hostname | etc. I want to get every IP ...
248
votes
13answers
255096 views

Best way to test if a row exists in a MySQL table

I'm trying to find out if a row exists in a table. Using MySQL, is it better to do a query like this: SELECT COUNT(*) AS total FROM table1 WHERE ... and check to see if the total is non-zero or is ...
88
votes
7answers
109735 views

SQL Server IN vs. EXISTS Performance

I'm curious which of the following below would be more efficient? I've always been a bit cautious about using IN because I believe SQL Server turns the result set into a big IF statement. For a large ...
191
votes
9answers
144326 views

Check if multiple strings exist in another string

How can I check if any of the strings in an array exists in another string? Like: a = ['a', 'b', 'c'] str = "a123" if a in str: print "some of the strings found in str" else: print "no strings f...
198
votes
8answers
301851 views

INSERT IF NOT EXISTS ELSE UPDATE?

I've found a few "would be" solutions for the classic "How do I insert a new record or update one if it already exists" but I cannot get any of them to work in SQLite. I have a table defined as follo...
254
votes
13answers
523140 views

How to check if element exists in the visible DOM?

How do you test an element for existence without the use of the getElementById method? I have setup a live demo for reference. I will also print the code on here as well: <!DOCTYPE html> <ht...
197
votes
16answers
263268 views

How to check if mysql database exists

Is it possible to check if a (MySQL) database exists after having made a connection. I know how to check if a table exists in a DB, but I need to check if the DB exists. If not I have to call another...
185
votes
30answers
302835 views

MySQL > Table doesn't exist. But it does (or it should)

I did change the datadir of a MySQL installation and following some steps it worked fine. Every base I had was moved correctly but one. I can connect and USE the database, even SHOW TABLES returns me...
65
votes
1answers
133776 views

SQL - IF EXISTS UPDATE ELSE INSERT INTO

What I'm trying to do is INSERT subscribers in my database, but IF EXISTS it should UPDATE the row, ELSE INSERT INTO a new row. Ofcourse I connect to the database first and GET the $name, $email and ...
84
votes
7answers
107918 views

Best way to check if object exists in Entity Framework?

What is the best way to check if an object exists in the database from a performance point of view? I'm using Entity Framework 1.0 (ASP.NET 3.5 SP1).

Previous Next