SQL development
If you're new to SQL, you can learn more from this course: SQL.
Creating tables
- Many data typesCREATE TABLE customers (id INTEGER PRIMARY KEY, name TEXT, age INTEGER, weight REAL);
- Using primary keysCREATE TABLE customers (id INTEGER PRIMARY KEY, age INTEGER);
Inserting data
- Inserting dataINSERT INTO customers VALUES (73, "Brian", 33);
- Inserting data for named columnsINSERT INTO customers (name, age) VALUES ("Brian", 33);
Querying data
- Select everythingSELECT * FROM customers;
- Filter with conditionSELECT * FROM customers WHERE age > 21;
- Filter with multiple conditionsSELECT * FROM customers WHERE age < 21 AND state = "NY";
- Filter with INSELECT * FROM customers WHERE plan IN ("free", "basic");
- Select specific columnsSELECT name, age FROM customers;
- Order resultsSELECT * FROM customers WHERE age > 21 ORDER BY age DESC;
- Transform with CASESELECT name, CASE WHEN age > 18 THEN "adult" ELSE "minor" END "type" FROM customers;
Aggregating data
- Aggregate functionsSELECT MAX(age) FROM customers;
- Grouping dataSELECT gender, COUNT(*) FROM students GROUP BY gender;
Updating and deleting data
- Updating dataUPDATE customers SET age = 33 WHERE id = 73;
- Deleting dataDELETE FROM customers WHERE id = 73;
Our implementation of SQL is based on a popular dialect of SQL known as SQLite.
To run SQL in the browser, we make use of these technologies:
To run SQL in the browser, we make use of these technologies:
No comments:
Post a Comment