Mac-mini:baseball raj$ sqlite3 baseball.db
SQLite version 3.39.5 2022-10-14 20:58:05
Enter ".help" for usage hints.
sqlite> .help
.auth ON|OFF             Show authorizer callbacks
.backup ?DB? FILE        Backup DB (default "main") to FILE
.bail on|off             Stop after hitting an error.  Default OFF
.binary on|off           Turn binary output on or off.  Default OFF
.cd DIRECTORY            Change the working directory to DIRECTORY
.changes on|off          Show number of rows changed by SQL
.check GLOB              Fail if output since .testcase does not match
.clone NEWDB             Clone data into NEWDB from the existing database
.connection [close] [#]  Open or close an auxiliary database connection
.databases               List names and files of attached databases
.dbconfig ?op? ?val?     List or change sqlite3_db_config() options
.dbinfo ?DB?             Show status information about the database
.dump ?OBJECTS?          Render database content as SQL
.echo on|off             Turn command echo on or off
.eqp on|off|full|...     Enable or disable automatic EXPLAIN QUERY PLAN
.excel                   Display the output of next command in spreadsheet
.exit ?CODE?             Exit this program with return-code CODE
.expert                  EXPERIMENTAL. Suggest indexes for queries
.explain ?on|off|auto?   Change the EXPLAIN formatting mode.  Default: auto
.filectrl CMD ...        Run various sqlite3_file_control() operations
.fullschema ?--indent?   Show schema and the content of sqlite_stat tables
.headers on|off          Turn display of headers on or off
.help ?-all? ?PATTERN?   Show help text for PATTERN
.hex-rekey OLD NEW NEW   Change the encryption key using hexadecimal
.import FILE TABLE       Import data from FILE into TABLE
.import FILE TABLE       Import data from FILE into TABLE
.imposter INDEX TABLE    Create imposter table TABLE on index INDEX
.indexes ?TABLE?         Show names of indexes
.limit ?LIMIT? ?VAL?     Display or change the value of an SQLITE_LIMIT
.lint OPTIONS            Report potential schema issues.
.log FILE|off            Turn logging on or off.  FILE can be stderr/stdout
.mode MODE ?OPTIONS?     Set output mode
.nonce STRING            Suspend safe mode for one command if nonce matches
.nullvalue STRING        Use STRING in place of NULL values
.once ?OPTIONS? ?FILE?   Output for the next SQL command only to FILE
.open ?OPTIONS? ?FILE?   Close existing database and reopen FILE
.output ?FILE?           Send output to FILE or stdout if FILE is omitted
.parameter CMD ...       Manage SQL parameter bindings
.print STRING...         Print literal STRING
.progress N              Invoke progress handler after every N opcodes
.prompt MAIN CONTINUE    Replace the standard prompts
.quit                    Exit this program
.read FILE               Read input from FILE or command output
.rekey OLD NEW NEW     Change the encryption key
.recover                 Recover as much data as possible from corrupt db.
.restore ?DB? FILE       Restore content of DB (default "main") from FILE
.save ?OPTIONS? FILE     Write database to FILE (an alias for .backup ...)
.scanstats on|off        Turn sqlite3_stmt_scanstatus() metrics on or off
.schema ?PATTERN?        Show the CREATE statements matching PATTERN
.selftest ?OPTIONS?      Run tests defined in the SELFTEST table
.separator COL ?ROW?     Change the column and row separators
.session ?NAME? CMD ...  Create or control sessions
.sha3sum ...             Compute a SHA3 hash of database content
.shell CMD ARGS...       Run CMD ARGS... in a system shell
.show                    Show the current values for various settings
.stats ?ARG?             Show stats or turn stats on or off
.system CMD ARGS...      Run CMD ARGS... in a system shell
.tables ?TABLE?          List names of tables matching LIKE pattern TABLE
.testcase NAME           Begin redirecting output to 'testcase-out.txt'
.testctrl CMD ...        Run various sqlite3_test_control() operations
.text-rekey OLD NEW NEW  Change the encryption key using hexadecimal
.timeout MS              Try opening locked tables for MS milliseconds
.timer on|off            Turn SQL timer on or off
.trace ?OPTIONS?         Output each SQL statement as it is run
.vfsinfo ?AUX?           Information about the top-level VFS
.vfslist                 List all available VFSes
.vfsname ?AUX?           Print the name of the VFS stack
.width NUM1 NUM2 ...     Set minimum column widths for columnar output
sqlite> .tables
results  teams  
sqlite> .schema teams
CREATE TABLE teams (
  tname varchar2(20),
  primary key (tname)
);
sqlite> .schema results
CREATE TABLE results (
  datePlayed date, 
  home varchar2(20),
  visitor varchar2(20),
  hruns number(3),
  vruns number(3),
  primary key (datePlayed,home),
  foreign key (home) references teams,
  foreign key (visitor) references teams
);
sqlite> select * from teams;
ATL
STL
CHC
ARI
CLE
sqlite> select tname from teams;
ATL
STL
CHC
ARI
CLE
sqlite> select * from results;
2004-03-20|ARI|CHC|10|11
2004-03-23|ATL|STL|0|1
2004-03-27|STL|CHC|7|9
2004-03-27|CLE|ATL|1|0
2004-03-30|ATL|CHC|10|5
2004-04-01|CLE|ARI|8|8
2004-04-15|ARI|ATL|3|11
2004-04-17|CLE|STL|7|11
2004-04-20|STL|ARI|10|12
2004-04-22|CHC|CLE|7|4
2004-04-29|STL|ATL|2|10
2004-05-01|ATL|CLE|14|14
2004-05-01|CHC|STL|10|0
2004-05-04|ARI|CLE|8|7
2004-05-08|ATL|ARI|6|8
2004-05-13|STL|CLE|3|6
2004-05-15|ARI|STL|7|13
2004-05-15|CLE|CHC|6|8
2004-05-18|ARI|CHC|13|5
2004-05-22|ATL|STL|3|6
sqlite> select datePlayed,home,visitor from results;
2004-03-20|ARI|CHC
2004-03-23|ATL|STL
2004-03-27|STL|CHC
2004-03-27|CLE|ATL
2004-03-30|ATL|CHC
2004-04-01|CLE|ARI
2004-04-15|ARI|ATL
2004-04-17|CLE|STL
2004-04-20|STL|ARI
2004-04-22|CHC|CLE
2004-04-29|STL|ATL
2004-05-01|ATL|CLE
2004-05-01|CHC|STL
2004-05-04|ARI|CLE
2004-05-08|ATL|ARI
2004-05-13|STL|CLE
2004-05-15|ARI|STL
2004-05-15|CLE|CHC
2004-05-18|ARI|CHC
2004-05-22|ATL|STL
sqlite> select datePlayed,home,visitor from results where home='ATL';
2004-03-23|ATL|STL
2004-03-30|ATL|CHC
2004-05-01|ATL|CLE
2004-05-08|ATL|ARI
2004-05-22|ATL|STL
sqlite> select datePlayed,home,visitor from results where visitor='ATL';
2004-03-27|CLE|ATL
2004-04-15|ARI|ATL
2004-04-29|STL|ATL
sqlite> select datePlayed,home,visitor from results where home='ATL' union select datePlayed,home,visitor from results where visitor='ATL';
2004-03-23|ATL|STL
2004-03-27|CLE|ATL
2004-03-30|ATL|CHC
2004-04-15|ARI|ATL
2004-04-29|STL|ATL
2004-05-01|ATL|CLE
2004-05-08|ATL|ARI
2004-05-22|ATL|STL
sqlite> select datePlayed,home,visitor from results where home='ATL' or visitor='ATL';
2004-03-23|ATL|STL
2004-03-27|CLE|ATL
2004-03-30|ATL|CHC
2004-04-15|ARI|ATL
2004-04-29|STL|ATL
2004-05-01|ATL|CLE
2004-05-08|ATL|ARI
2004-05-22|ATL|STL
sqlite> .quit
Mac-mini:baseball raj$