Questions tagged [clause]
252 questions
219
votes
8 answers
The SQL OVER() clause - when and why is it useful?
USE AdventureWorks2008R2;
GO
SELECT SalesOrderID, ProductID, OrderQty
,SUM(OrderQty) OVER(PARTITION BY SalesOrderID) AS 'Total'
,AVG(OrderQty) OVER(PARTITION BY SalesOrderID) AS 'Avg'
,COUNT(OrderQty) OVER(PARTITION BY SalesOrderID)…

WithFlyingColors
- 2,650
- 4
- 20
- 25
70
votes
5 answers
How to collapse If, Else, For, Foreach, etc clauses?
I get stuck sometimes with very long clauses and I am looking for a way that allows me to collapse them, same way as I can collapse classes, methods and namespaces by default.
Is there a Visual Studio extension that does that? neither ReSharper nor…

Moslem Ben Dhaou
- 6,897
- 8
- 62
- 93
63
votes
9 answers
Using variable in a LIMIT clause in MySQL
I am writing a stored procedure where I have an input parameter called my_size that is an INTEGER. I want to be able to use it in a LIMIT clause in a SELECT statement. Apparently this is not supported, is there a way to work around this?
# I want…

MPX
- 1,075
- 3
- 10
- 9
33
votes
2 answers
"Not equal" sign in Visual Prolog?
I can't find any documentation on "not equal" sign in Visual Prolog. Please provide the right solution of this problem:
class predicates
sister : (string Person, string Sister) nondeterm(o,o).
clauses
sister(Person, Sister) :-
…

Egor
- 39,695
- 10
- 113
- 130
26
votes
1 answer
Is multiple .Where() statements in LINQ a performance issue?
I am wondering if there are performance implications of multiple .Where() statements. For example I could write:
var contracts = Context.Contract
.Where(
c1 =>
c1.EmployeeId == employeeId
)
.Where(
c1 =>
…

John
- 2,043
- 5
- 28
- 49
21
votes
1 answer
How to correctly use guard clause in Ruby
What is the correct way to use the guard clause in this sample?
def require_admin
unless current_user && current_user.role == 'admin'
flash[:error] = "You are not an admin"
redirect_to root_path
end
end
I don't know where to put…

Sasha
- 323
- 1
- 2
- 5
21
votes
1 answer
spock unit test loops in then clause
I have a test with loops in the then clause:
result.each {
it.name.contains("foo")
it.entity.subEntity == "bar"
}
for (String obj : result2) {
obj.name.contains("foo")
obj.entity.subEntity == "bar"
}
Newly I recognized that the loops are…

radio
- 897
- 2
- 10
- 25
17
votes
1 answer
Condition left join in CriteriaQuery
Hi everybody I am trying to do this in CriteriaQuery, I was searching so long but I can't found anything to do it, someone can help me?
SELECT b.name
FROM Empl a
LEFT OUTER JOIN Deplo b ON (a.id_depl = b.id_depl) AND b.id_place = 2;
I'm just…

Ricardo Romero Benítez
- 712
- 2
- 7
- 20
15
votes
7 answers
WHERE IN clause in Android sqlite?
I can't get WHERE IN clause to work on android SQLite database.
Is there any way to execute a statement like this in android? :
SELECT body FROM table1 WHERE title IN ('title1', 'title2', 'title3')

fediva
- 151
- 1
- 1
- 3
13
votes
3 answers
count the number of calls of a clause
I have a clause like following:
lock_open:-
conditional_combination(X),
equal(X,[8,6,5,3,6,9]),!,
print(X).
this clause succeed. But I want to know how many times conditional_combination() is called before…

Md Monjur Ul Hasan
- 1,705
- 1
- 13
- 36
12
votes
3 answers
MySQL group_concat with where clause
I got this problem with Group_Concat and a where filter. In my table i got module names which are linked to a client. I want to search clients by module name, but in the group concat i still want to see all modules that are owned by the client.…

telefoontoestel
- 357
- 1
- 2
- 14
10
votes
4 answers
How to Optimize the Use of the "OR" Clause When Used with Parameters (SQL Server 2008)
I wonder if there is any wise way to rewrite the following query so that the indexes on columns get used by optimizer?
CREATE PROCEDURE select_Proc1
@Key1 int=0,
@Key2 int=0
AS
BEGIN
SELECT key3
FROM Or_Table
WHERE (@key1 = 0 OR…

B Faley
- 17,120
- 43
- 133
- 223
9
votes
2 answers
How to split an NLP parse tree to clauses (independent and subordinate)?
Given an NLP parse tree like
(ROOT (S (NP (PRP You)) (VP (MD could) (VP (VB say) (SBAR (IN that) (S (NP (PRP they)) (ADVP (RB regularly)) (VP (VB catch) (NP (NP (DT a) (NN shower)) (, ,) (SBAR (WHNP (WDT which)) (S (VP (VBZ adds) (PP (TO to) (NP…

giorgio79
- 3,787
- 9
- 53
- 85
7
votes
2 answers
Elixir: function overloading with different arity
is there any way to define overload functions with different arity, e.g in C# I can just do:
foo(bar)
or
foo(bar, baz)
In Elixir, the only way to do that would be to put them in separate modules, which will get messy pretty quickly. Is there any…

tldr
- 11,924
- 15
- 75
- 120
6
votes
3 answers
Can a WHERE clause predicate evaluate to NULL?
Can a WHERE clause return NULL instead of TRUE or FALSE?
According to the exercise below it is possible, but i can't imagine an example that returns NULL, Is it really possible?
4. Which of the following values can NOT be returned after evaluation…

Roni Castro
- 1,968
- 21
- 40