Are the statements "If P is true then x exists" and "there exists x such that P is true" equivalent?

Consider these two statements:

1: P is true $implies$ $exists x$

2: $exists x$ such that P is true

Are they equivalent? If so, can the phrase "such that" be substituted by $impliedby$?

sql server – If not exists not working

I’m writing a query to move data from a table on a linked server into a localt table. The insert query works correctly and the data transfers as expected. However, the IF NOT EXISTS statement doesn’t work as expected and the same data is written to the local table, despite the URL already existing in the local table.

I’ve also tried a WHERE NOT EXISTS statement and adding the data into a temp table before moving across but neither worked.

Any help would be greatly appreciated!

DECLARE @URL NVARCHAR(MAX)
DECLARE db_cursor CURSOR FOR
  SELECT TOP(1) testurl
  FROM  (Linked-Server).exampledb.dbo.tblexample

OPEN db_cursor

FETCH next FROM db_cursor INTO @URL

WHILE @@FETCH_STATUS = 0
  BEGIN
      IF NOT EXISTS (SELECT id
                     FROM  exampledb2.dbo.tblexample2 tdb2
                     WHERE  tdb2.url = @URL)
        BEGIN
            INSERT INTO exampledb2.dbo.tblexample2
                        ((id),
                         (firstname),
                         (lastname),
                         (dob),
                         (unit),
                         (url),
                         (lasterror),
                         (lastupdated),
                         (timeaddedtodatabase))
            SELECT id,
                   testfirstname,
                   testlastname,
                   testdob,
                   testarea,
                   testurl,
                   'Added to database table',
                   CURRENT_TIMESTAMP,
                   CURRENT_TIMESTAMP
            FROM   (Linked-Server).exampledb.dbo.tblexample
            WHERE  testurl IS NOT NULL
        END

      FETCH next FROM db_cursor INTO @URL
  END

CLOSE db_cursor

DEALLOCATE db_cursor 

hash tables – Time complexity of checking whether a string exists in a HashSet

From what I know hash sets generally have complexity of O(1) (unless the hash function is bad, but let’s just ignore that for this question). However, sets need to either read the full data so as to make a hash function that’s guaranteed to return a unique result for every input or they need to make a comparison to make sure the data is the same otherwise. Doesn’t that mean that the complexity for strings should be O(m) where m is the length of the string, at least if we accept that these strings can get arbitrarily large? Is there something I do not understand?

The reason I’m asking is because I solved a problem with a trie and the provided solution was solved with a set (that was the only difference), but it assumed that arbitrarily large strings can be found to exist or to not exist in a set in O(1) time. The problem is to find which words in a set of words can be formed using other words in the set (words can be used multiple times) – for example in (“a”, “bc”, “cd”, “acd”, “abcd”) only “acd” can be formed using other words, though I don’t think the specific problems matters much.

Creating/dropping MySQL users using “IF NOT EXISTS” when row based replication is in place

I’d like to know the affect of using “IF NOT EXISTS” when creating or dropping users when row based replication is being used to replicate data to a mysql slave. I know that in the past I have broken replication by creating or dropping users that already existed (or didn’t exist) on the slave, even though row based replication was being used. It seems that the user table isn’t replicated in a row based fashion even though the database itself is. Would adding “if not exists” to my create or drop statements prevent me from breaking replication in the future?

mysql – How to alter column to make it primary key when one already exists mysql8?

 id         | bigint unsigned | NO   | PRI | NULL    | auto_increment |
 | title      | varchar(255)    | NO   |     | NULL    |                |
 | category   | varchar(255)    | NO   |     | NULL    |                |
 | summary    | varchar(10000)  | NO   |     | NULL    |                |
 | detail     | mediumtext      | NO   |     | NULL    |                |
 | created_at | timestamp       | YES  |     | NULL    |                |   
 | updated_at | timestamp       | YES  |     | NULL    |                |
 | image      | mediumblob      | YES  |     | NULL    |                |
 | image1     | mediumblob      | YES  |     | NULL    |                |
 | image3     | mediumblob      | YES  |     | NULL    |                |
 | phold      | varchar(50)     | NO   |     | NULL    |                |
 +------------+-----------------+------+-----+---------+----------------+

I have this database now,I want to make a one-one relationship with with another table with where I use column ( title ) to link specific data. When I run

mysql> alter table tours add primary key (id,title);

OR

mysql> alter table tours add constraint pk_tours primary key (id, title);

The error:

ERROR 1068 (42000): Multiple primary key defined

on both queries.

I want another table named itinery where I use to link it with former table with help of volumn title ;

I am using mysql 8 with laravel 8.
Thanks

linear algebra – Proof or disprove: There exists a real n x n matrix A that satisfies the equation when n is even.

Prove or disprove: There exists a real n × n matrix A with

$$
A^2+2cdot A+5cdot I_n = 0
$$

if and only if n is even.

I could not find a counterexample for an odd n. Therefore, I suspect that the statement is true, but I have not yet found a solution.

SQL SERVER INSERT CASE WHERE NOT EXISTS not working

INSERT INTO (coll18_tesutest).(dbo).(PERMIL_STATUSES) (PERMIL_STATUSES.POS, PER_MILITARY_ID, PERMIL_MIL_STATUS)
SELECT VETERAN_ASSOC.POS, VETERAN_ASSOC.ID, VETERAN_TYPE
FROM VETERAN_ASSOC 
JOIN STPR_STATUSES ON SUBSTRING(STPR_STATUSES.STUDENT_PROGRAMS_ID, 1, 7) = (VETERAN_ASSOC.ID) 
WHERE STPR_STATUSES.POS=1 AND STPR_STATUS='A'    
AND NOT EXISTS  
    (SELECT   
    (CASE
    WHEN VETERAN_TYPE IN ('AAIR','AANG','AARMY','ACG','AMAR','ANAVY','ANG')
     THEN 'ACT'
     WHEN VETERAN_TYPE IN ('DODAF', 'DODAG','DODAR','DODCG','DODMA','DODNA','DODNG') 
      THEN 'DOD'
      WHEN VETERAN_TYPE IN ('FAMAF','FAMAG','FAMAR','FAMCG','FAMMA','FAMNA','FAMNG')
      THEN 'DEP'
      WHEN VETERAN_TYPE IN ('RAIR','RARMY','RCG','RMAR','RNAVY','RNG')
      THEN 'RES'
      WHEN VETERAN_TYPE IN ('VAIR','VANG','VARM','VCG','VMAR','VNAVY','VNG')
      THEN 'HON'
 END) AS PERMIL_MIL_STATUS, 
    (CASE 
    WHEN VETERAN_TYPE IN ('AAIR','DODAF','FAMAF','RAIR','VAIR')
    THEN 'AF'
    WHEN VETERAN_TYPE IN ('AANG','DODAG','FAMAG','VANG')
    THEN 'ANG'
    WHEN VETERAN_TYPE IN ('AARMY','DODAR','FAMAR','RARMY','VARM')
    THEN 'ARMY' 
    WHEN VETERAN_TYPE IN ('ACG','DODCG','FAMCG','RCG','VCG') 
    THEN 'CG'
    WHEN VETERAN_TYPE IN ('AMAR','DODMA','FAMMA','RMAR','VMAR') 
    THEN 'M'
    WHEN VETERAN_TYPE IN ('ANAVY','DODNA','FAMNA','RNAVY','VNAVY')
    THEN 'NAVY'
    WHEN VETERAN_TYPE IN ('ANG','DODNG','FAMNG','RNG' ,'VNG')  
    THEN 'NG'
END)  AS PERMIL_BRANCH 
FROM PERMIL_STATUSES
WHERE PER_MILITARY_ID=VETERAN_ASSOC.ID
AND PERMIL_STATUSES.POS=1
AND PERMIL_STATUS_START_DATE='2021-06-30'
AND PERMIL_PRIMARY_FLAG='Y');

Prove that for any connected graph G there exists a graph H such that G≅Z[H]

Prove that for any connected graph $G$ there exists a graph $H$ such that $Gcong Z(H)$ (are isomorphic), where $Z(H)$ denotes the graph induced by the center of $H$.

For this exercise… well, I don’t even know where to start. Suggestions…?!?

What is the most efficient, quickest, lightest way to check if a SharePoint list exists in a SSO/MFA environment?

Option 1: Find a list by Title
It’s not ideal, but you can check if the list exists using this REST query:

https://YOUR_SITE/_api/Web/Lists/?$filter=Title eq 'Documents'

It does return some metadata, but with no list items.
You can reduce the amout of metadata you get by adding this header to your request:

accept: application/json; odata=minimalmetadata

Option 2. Send GET request using list URL

Send a GET request directly to the list URL

If you know a library/list URL, you can send a GET request to this URL. For example

https://YOUR_SITE/Library_THAT_DOES_NOT_EXIST

This will return a 404 status. It means that the list does not exist.

If you send a GET request to the library/list that exists, you will get 2** response, meaning it exists

https://YOUR_SITE/Shared Documents

general topology – Prove that $forall xin E, exists zin Fsubset E, inf_{yin F}|x-y|=|x-z|$, where $F$ is compact and $E$ is a normed vector space.

Let $(E,|cdot|)$ be a normed vector space and let $Fsubseteq E$ be a non-empty compact subset. We define the distance from $x$ to $F$ as
$$begin{align}
dcolon &Etimesmathcal{P}(E)setminus emptysettomathbb{R}\
&(x,F)mapstoinf_{yin F}|x-y|.
end{align}$$

Prove that
$$forall xin E,exists zin F,; d(x,F)=|x-z|.$$

Definition of compact set: A set $F$ is said to be compact if and only if every sequence of elements of $F$ has a subsequence converging on $F$.

From this, it follow that $d(x,F)=0iff xin F$ (this was a previous problem and it only relies on $F$ being closed).
I don’t really know where to start with the proof, any good hints (or incomplete work) would be great.