Questions tagged [syntax]

The set of rules that define the combinations of symbols that are considered to be correctly structured for that language.

276 questions
7
votes
1 answer

Do any SQL dialects permit the logical sequence of SELECT clauses?

SELECT in ISO/IEC-standard SQL prescribes the following syntactical order for the sub-clauses: SELECT projection-expressions FROM sources WHERE predicate-expression GROUP BY key-expression HAVING predicate-expression ORDER BY …
Dai
  • 574
  • 3
  • 17
3
votes
2 answers

Using max result as a value for a predicate in SQL

Say I want to find all the employees that earn more than all of the employees of Google, is it possible to use the result from max as if it was a single value and not a table like so? select person-name from Works where salary > ( select…
shinzou
  • 253
  • 1
  • 7
1
vote
5 answers

More efficient way to write multiple "AND"?

Anyone know a way to write this in a different manner ? SELECT tableA.NO FROM tableA WHERE tableA.NO IN (SELECT GRI_NO FROM tableBB WHERE GRO_NO =62) AND tableA.NO IN (SELECT GRI_NO FROM tableBB WHERE GRO_NO =50) AND tableA.NO IN (SELECT GRI_NO…
Deathunt
  • 21
  • 4
1
vote
2 answers

Using exists in a query instead of a regular where

I saw this query that finds all the employees with more than one degree: select id, name from employee E where exists ( select * from academics A1, academics A2 where A1.emp_id = E.id and A2.emp_id = E.id and A1.discipline !=…
shinzou
  • 253
  • 1
  • 7
1
vote
1 answer

Several SQL syntax questions

I have several small questions and I wrote some simple examples to clarify them: Will a nested aggregate take one value from from all groups? Like the minimal maximum of all groups? or the minimum count? Select x, min(max(z)) From y Group by x On…
shinzou
  • 253
  • 1
  • 7
0
votes
1 answer

SQL where clause effect on table?

I have sql query as select sourceIP, sum(sourceBytes) from flows group by sourceIP order by sum(sourceBytes) desc This brings result (dummy) as:- sourceIp SourceBytes 192.168.1.2 100 192.168.1.3 79 192.168.1.4 67 192.168.1.5 4 192.168.1.6…
asadz
  • 635
  • 1
  • 5
  • 6
0
votes
1 answer

Need Some SQL help

I need to pass the following SQL statement: UPDATE table_products SET shipping = "a:5:{s:16:"min_items_in_box"; i:0;s:16:"max_items_in_box"; i:0;s:10:"box_length";i:0;s:9:"box_width";i:0;s:10:"box_height";i:0;}"; I'm getting a syntax error from…
user20348
  • 9
  • 1
0
votes
1 answer

Is capitalization of SQL commands/keywords required, expected or completely optional?

Also, is it done automatically in some environments?
user70448
  • 13
  • 2