Home > OS >  name list in PostgreSQL 13.0
name list in PostgreSQL 13.0

Time:11-08

list the name autors with the first name chris by alfabetic order

Tabela ESTRELAS Nome da coluna Tipo Descrição id INTEGER id do gênero nome_estrela VARCHAR Nome da estrela de cinema (atores e atrizes)

SELECT nome_estrela
FROM ESTRELAS
WHERE nome_estrela IN (SELECT split_part('', 'nome_estrelas', 00.)
                       FROM ESTRELAS
                      ORDER BY nome_estrela ASC
                      WHERE nome_estrela ( SELECT split_part('nome_estrela', ' ', 00.) 
                                               FROM ESTRELAS
                                               WHERE nome_estrela LIKE 'Chris%'
                                              )
                       );

/usr/local/bundle/gems/sequel-5.47.0/lib/sequel/adapters/postgres.rb:156:in `exec': PG::SyntaxError: ERROR:  syntax error at or near "WHERE"
LINE 13:                       WHERE nome_estrela ( SELECT split_part...
                               ^
 (Sequel::DatabaseError)

list the chris last names by asc.

CodePudding user response:

If all you want is to list the names where the first name is Chris in alphabetical order and nome_estrela is the column containing the full name, the following should work:

SELECT nome_estrela
FROM ESTRELAS
WHERE nome_estrela LIKE 'Chris%'
ORDER BY nome_estrela ASC
  • Related