Menu

WHERE Example in SQLite using BETWEEN

WHERE Example in SQLite using BETWEEN


  • First create table.
  • CREATE TABLE  x ( a, b );
    INSERT INTO x VALUES ( 1, ‘Alice’ );
    INSERT INTO x VALUES ( 2, ‘Bob’ );
    INSERT INTO x VALUES ( 3, ‘Charlie’ );
  • CREATE TABLE y ( c, d );
    INSERT INTO y VALUES ( 1, 3.14159 );
    INSERT INTO y VALUES ( 1, 2.71828 );
    INSERT INTO y VALUES ( 2, 1.61803 );
  • CREATE TABLE z ( a, e );
    INSERT INTO z VALUES ( 1, 100 );
    INSERT INTO z VALUES ( 1, 150 );
    INSERT INTO z VALUES ( 3, 300 );
    INSERT INTO z VALUES ( 9, 900 );
  • select * from x where b= ‘Alice’;
    |a|b
    |1|Alice
  •  range of values.
  • select * from y where d between 1.0 and 3.0
    |c|d
    |1|2.71828
    |2|1.61803 
  • sum of c and d
  • select c,d c+d as sum from y where sum<4.0;
    |c| d    | sum
    |1| 2.71828| 3.71828
    |2| 1.61803| 3.61803

For More Information Please Visit

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...