SQL - HenriBech/SWO_DACH_wiki GitHub Wiki

SQL

CodeCademy Reference:

  • Manipulation: CREATE, ALTER and DELETE tables; INSERT and UPDATE data
  • Queries: SELECT and ORDER using conditional operators
  • Aggregate Functions: calculate SUM, MIN/MAX, COUNT, AVG, ROUND from column data; GROUP said data based on column data
  • Multiple Tables: JOIN data from multiple tables based on PRIMARY and FOREIGN KEY, stack tables and use aliases

Implementations and Bindings

SQLite: terminal based database engine

Setup:

  1. Download Latest Release

  2. Extract .zip to desired location

  3. Open bash terminal

    Enter echo "alias sqlite3=\"winpty ${PWD}/sqlite3.exe\"" >> ~/.bashrc to create an alias

  4. Now you can type sqlite3 in any bash terminal to start SQLite

  5. To open an existing database type sqlite3 <database>.<db/sqlite>

Create empty database:

  1. Navigate to desired location
  2. Open bash terminal
  3. Type sqlite3 <database-name>.db "VACUUM;"
  4. A usable Database should now have been created in the current directory

sqlite3.js: Asynchronous Node SQL library

Setup:

  1. Make sure you have Node.js and npm installed
  2. In your workspace, open any terminal window
  3. Type npm install sqlite3
  4. In your .js file add const sqlite3 = require('sqlite3') to the top

CodeCademy Reference:

  • Learn Node-SQLite: connect to databases, get queries and run commands

    Note that this library will run asynchronously! Structure your code accordingly

⚠️ **GitHub.com Fallback** ⚠️