Skip to content

Instantly share code, notes, and snippets.

@mdevan
Created November 9, 2021 03:35
Show Gist options
  • Save mdevan/c14e43ccde6c8c00cd16c91b0909c28e to your computer and use it in GitHub Desktop.
Save mdevan/c14e43ccde6c8c00cd16c91b0909c28e to your computer and use it in GitHub Desktop.
sqlite select all columns
sqlite> create table students (name text, class text, height integer);
sqlite> insert into students values ('Haki', 'A', 186), ('Dan', 'A', 175), ('Jax', 'A', 182), ('George', 'B', 178), ('Bill', 'B', 167), ('David', 'B', 178);
sqlite> select *, max(height) as tallest from students group by class;
┌────────┬───────┬────────┬─────────┐
│ name │ class │ height │ tallest │
├────────┼───────┼────────┼─────────┤
│ Haki │ A │ 186 │ 186 │
│ George │ B │ 178 │ 178 │
└────────┴───────┴────────┴─────────┘
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment