Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#shell scripts #http://www.sqlitetutorial.net/sqlite-autoincrement/ #create Database and table with auto increment rowid and no empty entries sqlite3 example.db "CREATE TABLE people( fname text NOT NULL, lname text NOT NULL);" #manual id sqlite3 example.db "CREATE TABLE table1(id integer primary key,word1 text,word2 text);" #insert into table sqlite3 example.db "INSERT INTO table1 VALUES (1,'My First Entry', 'My Second Entry');" #view all entries sqlite3 example.db "SELECT * FROM table1;" #or to see with rowid sqlite3 example.db "SELECT rowid, word1, word2 FROM table1;" #for id auto increment user null sqlite3 example.db "INSERT INTO table1 VALUES (NULL, 'BOB', 'SMITH');" #create test data for i in {1..100}; do word1="$(grep -v "'" /usr/share/dict/words|shuf|head -n1)" word2="$(grep -v "'" /usr/share/dict/words|shuf|head -n1)" sqlite3 example.db "INSERT INTO table1 VALUES (NULL,'$word1', '$word2');" done #view column of all entries sqlite3 example.db "SELECT word1 FROM table1;" sqlite3 example.db "SELECT id, word1 FROM table1;" #search queary sqlite3 example.db "SELECT id, word1 FROM table1 WHERE id IS 99;" sqlite3 example.db "SELECT id, word1 FROM table1 WHERE word1 IS 'epipolize';" sqlite3 example.db "SELECT id, word1 FROM table1 WHERE word1 LIKE '%er';" #Delete entries sqlite3 example.db "DELETE FROM table1 WHERE id='99';" #add Column sqlite3 example.db "ALTER TABLE table1 ADD COLUMN phone TEXT;" sqlite3 example.db "INSERT INTO table1 VALUES (NULL, 'JANE', 'SMITH', '555-555-5563');" #if you don't have a phone number sqlite3 example.db "INSERT INTO table1 VALUES (NULL, 'JAck', 'SMITH', NULL);" sqlite3 example.db "INSERT INTO table1 (word2, word1) VALUES ('GREEN', 'PINK');" #update entry sqlite3 example.db "UPDATE table1 SET phone='555-555-5555' WHERE rowid=4;"
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)