Databsase
- DB System - SQLite
- GUI Front End - sqlitebrowser
Create Tables
- Songs
- Artists
CRUD - List of Operations
Create
- Create artists
- insert into artists (artist) values('Jagjit')
- insert into artists (artist) values('Himesh Reshamiya')
- Create songs
- insert into songs (song) values('Jhuki Jhuki Si Nazar')
- Relate song with artist(s)
- insert into songartists(artistid, songid) values(6, 3)
Read Flat/Simple Data
- Songs
- select * from songs
- Artists
- select * from artists
Interesting Reads
- How many songs?
- select count(*) from songs
- How many artists?
- ???
- Filters - Exact
- select * from artists where artist='Kishore Kumar'
- Filters - Wildcard
- select * from artists where artist like 'Lata%'
- Filters - Contains
- select * from artists where artist like '%Kumar%'
Updates
- Update artist name
- update artists set artist='Jagjit Singh' where artist='Jagjit'
Delete
- Delete an artist
- Delete from artists where artist = 'Himesh Reshamiya'
Complex Queries - Joins & Grouping
- Basic Join
- select artist, song from artists a, songs b, songartists c where a.artistid=c.artistid and b.songid=c.songid
- Joins with Grouping
- select artist, count(*) as "No. of Songs" from songartists, artists where songartists.artistid = artists.artistid group by artists.artistid
Summing it up
[ ]
Review
[ ]
Systems & Tools
[ ]
Anything else that can be imagined?
[ ]
Basic Operations
[ ]
Implication of each Operation
- Querying Database
[ ]
Simple Queries
[ ]
Joins
[ ]
Complex Queries
[ ]
Joins and it uses
[ ]
Count
[ ]
What else?
See you on 17th…
rahul.naskar@gmail.com