Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
development:database:start [2020/10/18 16:23] kalenpw |
development:database:start [2021/07/06 09:52] (current) kalenpw |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Database ====== | ====== Database ====== | ||
| - | These are all for MySQL | + | * [[ mongodb | MongoDB]] |
| + | * [[ mysql | MySQL ]] | ||
| + | * [[postgresql | Postgres ]] | ||
| - | ---- | ||
| - | ===== Cleaner Terminal Output ===== | ||
| - | MySQL can have quite messy output when running queries from the '' | ||
| - | <code mysql> | ||
| - | SELECT * FROM users\G | ||
| - | </ | ||
| - | |||
| - | Alternatively, | ||
| - | <code mysql> | ||
| - | pager less -SFX | ||
| - | SELECT * FROM users; | ||
| - | nopager; -- to turn off | ||
| - | </ | ||
| - | |||
| - | ---- | ||
| - | ===== Create User ===== | ||
| - | <code mysql> | ||
| - | CREATE USER ' | ||
| - | </ | ||
| - | |||
| - | ---- | ||
| - | ===== Grant permissions ===== | ||
| - | replace '' | ||
| - | <code mysql> | ||
| - | GRANT ALL PRIVILEGES ON *.* TO ' | ||
| - | </ | ||
| - | |||
| - | ---- | ||
| - | ===== Basic syntax ===== | ||
| - | ==== update ==== | ||
| - | <code mysql> | ||
| - | UPDATE employees SET email = ' | ||
| - | </ | ||
| - | |||
| - | |||
| - | ---- | ||
| - | ===== Many to Many Relationship Joins ===== | ||
| - | <code mysql> | ||
| - | SELECT | ||
| - | a.* | ||
| - | FROM | ||
| - | map_ads_categories m | ||
| - | JOIN ads a ON (m.ad_id = a.id) | ||
| - | WHERE | ||
| - | m.category_id = 28; | ||
| - | </ | ||
| - | <code mysql> | ||
| - | SELECT | ||
| - | * | ||
| - | FROM | ||
| - | map_ads_categories m | ||
| - | JOIN ads a ON (m.ad_id = a.id) | ||
| - | JOIN categories c ON (m.category_id = c.id) | ||
| - | WHERE | ||
| - | c.id = 28; | ||
| - | </ | ||