Skip to content

Instantly share code, notes, and snippets.

@TrevMcKendrick
Created September 25, 2013 03:45
Show Gist options
  • Save TrevMcKendrick/6694961 to your computer and use it in GitHub Desktop.
Save TrevMcKendrick/6694961 to your computer and use it in GitHub Desktop.
magical.db assignment
[23:35:51] code
-> mkdir artists
[23:35:55] code
-> cd artists/
[23:35:58] artists
-> sqlite3 artists.db
SQLite version 3.7.12 2012-04-03 19:43:07
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> CREATE TABLE artists(
...> name TEXT,
...> album_count INTEGER,
...> fans REAL,
...> );
Error: near ")": syntax error
sqlite> .schema
sqlite> CREATE TABLE artists(
...> name TEXT,
...> album_count INTEGER,
...> fans REAL
...> );
sqlite> .schema
CREATE TABLE artists(
name TEXT,
album_count INTEGER,
fans REAL
);
sqlite> ALTER TABLE artists ADD COLUMN band_size INTEGER;
sqlite> .schema
CREATE TABLE artists(
name TEXT,
album_count INTEGER,
fans REAL
, band_size INTEGER);
sqlite> DROP COLUMN fans;
Error: near "COLUMN": syntax error
sqlite> drop column fans;
Error: near "column": syntax error
sqlite> ALTER TABLE arists RENAME TO musicians;
Error: no such table: arists
sqlite> ALTER TABLE artists RENAME TO musicians;
sqlite> .schema
CREATE TABLE "musicians"(
name TEXT,
album_count INTEGER,
fans REAL
, band_size INTEGER);
sqlite> DROP TABLE artists;
Error: no such table: artists
sqlite> DROP TABLE musicians;
sqlite>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment