https://github.com/kevinhellos/sqlite3demo
Demo for using sqlite3
https://github.com/kevinhellos/sqlite3demo
Last synced: 10 months ago
JSON representation
Demo for using sqlite3
- Host: GitHub
- URL: https://github.com/kevinhellos/sqlite3demo
- Owner: kevinhellos
- License: mit
- Created: 2024-05-20T16:24:16.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-18T12:46:33.000Z (about 2 years ago)
- Last Synced: 2025-01-21T21:08:19.389Z (over 1 year ago)
- Language: JavaScript
- Size: 5.49 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sqlite3Demo
Demo for using sqlite3
## Commands
### Initialise a database
```sh
sqlite3 database.db
```
### Create table
E.g creating a Customers table
```sh
CREATE TABLE Customers(customer_id INTEGER NOT NULL, customer_name VARCHAR(255));
```
### Show all tables
```sh
.tables
```
### Show all commands use to create the table (show db structure)
```sh
.schema Customers
```
### Show all records
```sh
SELECT * FROM Customers;
```
### Enable foreign key constraint
```sh
PRAGMA foreign_keys=ON;
```
### Generate all of the commands needed to recreate the database
```sh
.dump
```
### Exit
```sh
.exit
```