Questions tagged [row-value-expression]

A row-value-expression is a SQL standard expression for specifying a row value. Other languages call this a record or a tuple.

A row-value-expression is a SQL standard expression for specifying a row value. Other languages call this a record or a tuple.

Definition

The SQL1992 Standard specifies a row value constructor as such:

<row value constructor> ::=
        <row value constructor element>
      | <left paren> <row value constructor list> <right paren>
      | <row subquery>

 <row value constructor list> ::=
      <row value constructor element>
          [ { <comma> <row value constructor element> }... ]

 <row value constructor element> ::=
        <value expression>
      | <null specification>
      | <default specification>

According to this definition, regular values and row values can thus be used interchangeably in SQL. This can be seen in expressions as these:

Using row values of degree = 1

SELECT * FROM table t
WHERE t.a = 1

Using row values of degree > 1

SELECT * FROM table t
WHERE (t.a, t.b) = (1, 2)

Support

Only few databases really support row value expressions as specified in the SQL standard. These include (with partial or full support):

  • DB2
  • HSQLDB
  • MYSQL
  • ORACLE
  • POSTGRES
20 questions
0
votes
3 answers

SQL Where clause

My application initially had a query similar to this one:- SELECT column_name from PERSON WHERE name in (list); where list is comma separated list. But, now the requirement has changed and i have to query the Persons table with name and age…
Lex
  • 1
0
votes
2 answers

Unable to delete duplicate rows with PostgreSQL

My query deletes the whole table instead of duplicate rows. Video as proof: https://streamable.com/3s843 create table customer_info ( id INT, first_name VARCHAR(50), last_name VARCHAR(50), phone_number VARCHAR(50) ); insert into…
Kay
  • 335
  • 3
  • 14
0
votes
1 answer

How to convert a single row into one column?

How to convert columns of one row into one row each? Having data in table as below: +------+------+------+------+ | col1 | col2 | col3 | col4 | +------+------+------+------+ | a1 | a2 | a3 | a4 | +------+------+------+------+ required…
Sam
  • 21
  • 4
0
votes
2 answers

How to compare groups of tuples in sql

How to compare groups of tuples in sql: consider the following example: TABLE T1 -------- GROUP VALUE ----- ----- A FOO A BAR X HHH X ZOO TABLE T2 -------- GROUP VALUE ----- ----- B ZOO C …
paweloque
  • 18,466
  • 26
  • 80
  • 136
0
votes
0 answers

How to display column values in gridview using pivot

I want to display dates of particular month in column header of gridview and corresponding value should be display under SELECT distinct cardno, name, min(convert(char(5), time , 108)) over (partition by cardno, CONVERT(varchar(20), time, 102) )…
baiju krishnan
  • 231
  • 4
  • 14
1
2