Is there in Cypher sometihg like RETURN all? - cypher

I have a code
MATCH (n1)-[r:CREATED_ON {manufactureDate: '11-03-2021'}]->(n2)
RETURN n1, r, n2;
Is there a shorthand to replace RETURN n1, r, n2; that would be equivalent to saying, "Return me all values of all nodes and relationships"? Like RETURN *.

As Kelvin Lawrence has said in comments, RETURN * exists, and it works. I just had a typo in my command.

Related

why soundex return irrelevant result

I wonder why :
WHERE 1=1
AND LTRIM(RTRIM(lastName)) ='Schmdli'
OR (
SOUNDEX(lastName) = SOUNDEX('Schmdli')
)
Return me result like
lastName
Schöntal
Schindler-Külling
Schindler
Schmidlin
Schindler
Schmidli
Schmidli
Schindler
while I expect only:
Schmidli
Schmidli
Schmidlin
My first AND LTRIM(RTRIM(lastName)) ='Schmdli' is to match exact value then with soundex I expect better near Schmdli result here some result like
Schöntal
Schindler-Külling
Schindler
shouldn't appear.
Thanks
Trivial answer: because SOUNDEX is a simple algorithm with limited space (one letter and three digits), and all of your examples happen to translate to the same one, S534, only taking into account the letters S, C, M and D. Incidentally, Schöntal only takes into account S, C, N and T, producing the same output since M and N encode in the same way, as do D and T.

About sql and logic. In the sql where clause, is "not (p and q)" equal to "(not p) or (not q)"

A SQL and logic problem. In the where clause, is
not (p and q)
equal to
(not p) or (not q)
Yes. De Morgan's laws are language-independent.
Refer the working fiddle:
Query 1: not (p and q)
select * from table1
where
!(p = 1 and q=1);
Query 2 : (not p) or (not q)
select * from table1
where p!=1 or q!=1;
There is no difference in the output and hence the boolean algebra logic !(p and Q) = (!p) or (!q) is true!!!
Though a bit late answer but what you are talking about is De Morgan's Law here. So your logic not (p and q) will get converted to
not p or not q
Cause Negation (not) will apply to to the statement (p and q)
not p
not and will get converted to or
not q
Although the two expressions are logically equivalent, they may not be functionally equivalent. It depends on the nature of p and q and the operation of the language's optimiser.
Consider, for instance, that p is false. In the case of (not p) or (not q), we can deduce that the expression is true without having to evaluate q. A clever optimiser that understands or might take a short cut like that. But we cannot do so in the case of not (p and q) (unless our theorised optimiser could itself apply de Morgan first).
Does anyone know if SQL Server or Oracle or the other major players does this type of optimisation?
The result may not just be a performance saving. Suppose the q is not just a simple boolean variable but some expression that includes the execution of some more complex function. If that function has side-effects other than returning a truth value, then by optimising-out the evaluation of q we would also not see those side effects.

Function format number

For oracle,
Can anyone fixes the function below to let it works with "a number (10,2)"? Just this condition only.
Here I come with the function..
CREATE OR REPLACE FUNCTION Fmt_num(N1 in NUMBER)
RETURN CHAR
IS
BEGIN
RETURN TO_CHAR(N1,'FM9,9999.99');
END;
/
And I can use this with the SQL statement as follow
SELECT Fmt_num(price) from A;
That depends on what you mean by "works" and what output you want. My guess is that you just want to update the format mask
to_char( n1, 'fm999,999,999.99' )
That assumes, though, that you want to use hard-coded decimal points and separators and that you want to use the American/ European convention of separating numbers in sets of 3 rather than, say, the traditional Indian system of representing large numbers.
CREATE OR REPLACE FUNCTION Fmt_num(N1 in NUMBER)
RETURN CHAR
IS
BEGIN
RETURN TO_CHAR(N1,'FM99,999,999.99');
END;
/
If you really want the comma every 4 digits, you could do this:
TO_CHAR(N1,'FM9999,9999,9999.99');
However, I'd recommend you use the locale-safe version (G for the grouping character, D for the decimal separator):
TO_CHAR(N1,'FM9999G9999G9999D99');

Objective-C operator (?) and (:)

What do the ? and : signify here?
#define MAX(a,b) ( ((a) > (b)) ? (a) : (b) )
This is a ternary operator (also available in C, to which Objective C is a superset, and other languages that borrowed from it).
The expression before ? is evaluated first; if it evaluates to non-zero, the subexpression before : is taken as the overall result; otherwise, the subexpression after the colon : is taken.
Note that subexpressions on both sides of : need to have the same type.
Also note that using macro for calculating MAX may produce unexpected results if arguments have side effects. For example, MAX(++a, --b) will produce a doubled side effect on one of the operands.
As Kjuly mentioned it should be greater than sign, It's just an if statement.
(a > b) ? a : b
If a is greater than b then a will be returned from MAX(a,b) function or if b is greater then if statement will be false and b will be returned.
The ternary (conditional) operator in C
Check Evan's answer
?: is a ternary operator. What ((a) > (b)) ? (a) : (b) stands for is:
if (a > b)
return a
else
return b
Refter it HERE.
This is a sort-of shorthand notation for a conditional. a ? b : c.
If a evaluates to true, then b, else c.
I believe this should be: #define MAX(a,b) ( ((a) > (b)) ? (a) : (b) )
so basically, if a is greater then b, then a, else b

Several comma separated calls in one row in Objective-C

Lately, I saw the following line:
[someObject release], someObject = nil;
Why does this work? Why and under which circumstances can there be several calls separated by , in one row? (Not ;)
Objective C is a superset of C, and , is an operator in C. It evaluates to the last expression in the chain, and creates a sequence point.
Semicolon ; cannot be used in an expression because it is not an operator.
You may have seen the , operator at work in a more common situation that involves for loops:
int i = 0, j = 0;
for ( ; i < 200 ; i++, j += 3) { // This is one of the more typical uses of ','
}
The comma operator evaluates the first operand and discards the result, then evaluates the second and returns its value. The first has no return value, and the second has a return value of nil in this case.