SQL

  • Declarative Hallmark: focuses on "what to get" not "how to do"
  • Common SQL queries
    Command/Query Example Meaning
    .open --new xx.db .open --new database.db Create a new database
    .open xx.db .open database.db Open a database
    CREATE TABLE table (definition); CREATE TABLE users (name TEXT); Create a table with a schema
    SELECT fields FROM table; SELECT name FROM users; Query data from a table
    UPDATE table SET field1=value1, ...; UPDATE users SET name="abc"; Update fields in a table
    INSERT INTO table (fields) VALUES (values); INSERR INTO table (name) VALUES ("abc"); Add data to a table
    XXXXX WHERE condition; SELECT * FROM users WHERE name="abc"; Conditions to filter data