Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Joining strings is called "concatenation." The concatenation operator in SQLite is "||". This is an example of concatenating multiple columns into a single column.</p> <pre><code>select Given || " " || Surname as "Full Name" from NameTable; </code></pre> <p>If you want to preserve a unique identifier for each row, you can also select the (implicit) "ROWID" column. One could also select the individual name columns, the aggregate column, and the "ROWID" column to have the full dataset.</p> <pre><code>select ROWID, Given, Surname, Given || " " || Surname as "Full Name" from NameTable; </code></pre> <p>The question on searching is a bit more involved, as it's not clear to me what you are trying to accomplish. Also, in the case where the user is inputting search criteria, the input could be provided in many different ways, e.g. partial or complete Given name or Surname, partial or complete Given name and surname, orders reversed on given and surname, etc. (complicating search).</p> <p>So, depending upon how you are allowing input you could search in different ways. The simplest way would be with a "like" operator. Depending on the size of your dataset, you might be able to create a virtual table that concatenates the Given and Surname columns into a single column and use that column for the like comparison. Or, you could use an "OR" operator to allow matches to either the Given or Surname columns.</p> <p>You may also want to be aware that SQLite supports a full text search engine. <a href="http://www.sqlite.org/fts3.html" rel="nofollow">http://www.sqlite.org/fts3.html</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload