Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hassanbahati/database-design-and-applications-
https://github.com/hassanbahati/database-design-and-applications-
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/hassanbahati/database-design-and-applications-
- Owner: HassanBahati
- Created: 2022-06-14T14:32:47.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-07T19:07:41.000Z (over 2 years ago)
- Last Synced: 2024-10-28T09:14:36.732Z (3 months ago)
- Language: Python
- Size: 39.8 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## set environment
.mode csv## import data file
.import "file" table_name# get design of table
.schema# for sql commands a termination is required
eg SELECT * FROM "table";## insert a movie into table
INSERT INTO table ("column", "column") VALUES ("value", "value");## select a particular value from the table
SELECT "column_field" FROM "table" WHERE "Film" LIKE "%see%"## delete a movie from the table
DELETE FROM movies WHERE FILM LIKE "%Waitress%"## update a field
UPDATE movies SET film = "Dear Collins" WHERE Film LIKE "%Dear%";## save database
.save moviesList## open database
.open moviesList.db## delte table
DELETE FROM table## Concatenation of queries - get movies whose id is in the list of ids with genre Romance
SELECT Film FROM movies WHERE id IN (SELECT movie_id FROM genre WHERE genre LIKE "%Romance%")SELECT genre FROM genre WHERE movie_id = (SELECT id FROM movies WHERE title LIKE "%Zack%");
.txt and .db
get a lst of movies and their genres## count through a table
SELECT COUNT(column) FROM table;## get the time taken by a query
.timer ON##
CREATE INDEX title_index ON shows (title);CREATE INDEX name_index ON people (name)
SELECT title FROM shows WHERE id IN (SELECT person_id FROM stars WHERE person_id IN (SELECT id FROM people WHERE name LIKE "%Thomas%"));
SELECT name FROM people WHERE person_id IN (SELECT person_id FROM stars show_id IN (SELECT id FROM shows WHERE title LIKE "%The Office%"));