Coder Social home page Coder Social logo

cis395-sqlite-labs's Introduction

CIS395 SQLite Labs

1. Run and stop the Docker container

# Build the docker image
$ docker-compose build

# Start the docker container
$ docker-compose up -d

# Stop the docker container
$ docker-compose down

2. Interact with SQLite

$ docker-compose exec sqlite sqlite3 /database/mydatabase.db
  • docker-compose exec: Allows you to run commands in a service container.
  • sqlite: This is the name of the service we're targeting (from your docker-compose.yml).
  • sqlite3 /database/mydatabase.db: This is the command we want to run inside the service container.

3. SQLite common commands

Show Databases

SQLite is a serverless, file-based, and lightweight SQL database engine. SQLite doesn't have the concept of multiple databases like MySQL or PostgreSQL. Instead, each SQLite database is a standalone file.

# Show the current database file's path
sqlite> .database
main: /database/mydatabase.db r/w

# List the main database and any attached databases
sqlite> .databases
main: /database/mydatabase.db r/w

Show Tables

# Show all tables in the current database
sqlite> .tables

Show Schema

# Show the schema of a table
sqlite> .schema <table_name>

Show Settings

# Show the current settings
sqlite> .show
        echo: off
         eqp: off
     explain: auto
     headers: off
        mode: list
   nullvalue: ""
      output: stdout
colseparator: "|"
rowseparator: "\n"
       stats: off
       width: 
    filename: /database/mydatabase.db

Exit

# Exit the sqlite3 shell
sqlite> .exit

# Or
sqlite> .quit

cis395-sqlite-labs's People

Contributors

qingquan-li avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.