0% found this document useful (0 votes)
39 views3 pages

Https Doc 0g 1c Apps Viewer - Googleusercontent

This document provides instructions and examples for using SQLite and performing basic CRUD (create, read, update, delete) operations on a sample database with tables for Users, Artists, Albums, Genres, and Tracks. It includes SQL statements to insert data into the tables, select data from single or joined tables, and shows the table creation statements.

Uploaded by

LuisITOxD
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views3 pages

Https Doc 0g 1c Apps Viewer - Googleusercontent

This document provides instructions and examples for using SQLite and performing basic CRUD (create, read, update, delete) operations on a sample database with tables for Users, Artists, Albums, Genres, and Tracks. It includes SQL statements to insert data into the tables, select data from single or joined tables, and shows the table creation statements.

Uploaded by

LuisITOxD
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

PythonforInformaticsDatabaseHandout

DownloadandinstallFireFoxandtheSQLiteManager
http://www.mozilla.org/enUS/firefox/new/
https://addons.mozilla.org/enUS/firefox/addon/sqlitemanager/

Queries
insertintoUsers(name,email)values('Ted','[email protected]')
deletefromUserswhereemail='[email protected]'
updateUserssetname="Charles"whereemail='[email protected]'
select*fromUsers
select*fromUserswhereemail='[email protected]'
select*fromUsersorderbyemail
insertintoArtist(name)values('LedZepplin')
insertintoArtist(name)values('AC/DC')
insertintoGenre(name)values('Rock')
insertintoGenre(name)values('Metal')
insertintoAlbum(title,artist_id)values('WhoMadeWho',2)
insertintoAlbum(title,artist_id)values('IV',1)
insertintoTrack(title,rating,len,count,album_id,genre_id)values('BlackDog',5,297,0,2,1)
insertintoTrack(title,rating,len,count,album_id,genre_id)values('Stairway',5,482,0,2,1)
insertintoTrack(title,rating,len,count,album_id,genre_id)values('AbouttoRock',5,313,0,1,2)
insertintoTrack(title,rating,len,count,album_id,genre_id)values('WhoMadeWho',5,207,0,1,2)
selectTrack.title,Genre.namefromTrackjoinGenreonTrack.genre_id=Genre.id

selectTrack.title,Artist.name,Album.title,Genre.namefromTrackjoinGenrejoinAlbumjoinArtiston
Track.genre_id=Genre.idandTrack.album_id=Album.idandAlbum.artist_id=Artist.id

CreateTableStatements:
CREATETABLE"Users"("name"TEXT,"email"TEXT)
CREATETABLE"Artist"("id"INTEGERPRIMARYKEYAUTOINCREMENTNOTNULLUNIQUE,"name"TEXT)
CREATETABLE"Album"("id"INTEGERPRIMARYKEYAUTOINCREMENTNOTNULLUNIQUE,artist_idINTEGER,"title"
TEXT)
CREATETABLE"Genre"("id"INTEGERPRIMARYKEYAUTOINCREMENTNOTNULLUNIQUE,"name"TEXT)
CREATETABLE"Track"("id"INTEGERPRIMARYKEYAUTOINCREMENTNOTNULLUNIQUE,album_idINTEGER,genre_id
INTEGER,lenINTEGER,ratingINTEGER,"title"TEXT,"count"INTEGER)

You might also like