AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Db browser for sqlite zip9/19/2023 Congratulations! You’re ready to manage a database.So I'm trying to get the table that's at the bottom of this post, by using SQLite to open the database of which I'm creating. The zip file contains the code which I am trying to modify, and also it includes the itunes library from which I get my values for my tables in SQLite. #DB BROWSER FOR SQLITE EXECUTE QUERY ZIP FILE# I'm not sure how to go about adding a genre field in my table, nor do I understand how to extract the last three titles which you can see at the bottom of this page. Here's the result that I should get if all has been done correctly: ON Track.genre_id = Genre.ID and Track.album_id = Album.id To grade this assignment, the program will run a query like this on your uploaded database and look for the data it expects to see: SELECT Track.title, Artist.name, Album.title, Genre.nameįROM Track JOIN Genre JOIN Album JOIN Artist This application will read an iTunes export file in XML and produce a properly normalized database with this structure: So here's the prompt for my homework assignment: #DB BROWSER FOR SQLITE EXECUTE QUERY HOW TO# Here's my code, where I'm having trouble changing the genre portion of the code. I should be getting a genre table in SQLite. Go to the SQLite Browser website and choose the download for whichever operating system you are using. Also I need to get the same result as what I have in my table above. Open the file and follow installation instructions. If name is None or artist is None or genre is None or album is None: Here is the complete code works for your situation: import as ET ( name, album_id, genre_id, length, rating, count ) ) (title, album_id, genre_id, len, rating, count) VALUES ( ?, ? )''', ( album, artist_id ) )Ĭur.execute('SELECT id FROM Album WHERE title = ? ', (album, ))Ĭur.execute('''INSERT OR IGNORE INTO Genre (name)Ĭur.execute('SELECT id FROM Genre WHERE name = ? ', (genre, ))Ĭur.execute('''INSERT OR REPLACE INTO Track Print name, artist, album, genre, count, rating, lengthĬur.execute('''INSERT OR IGNORE INTO Artist (name)Ĭur.execute('SELECT id FROM Artist WHERE name = ? ', (artist, ))Ĭur.execute('''INSERT OR IGNORE INTO Album (title, artist_id) If name is None or artist is None or album is None : If ( lookup(entry, 'Track ID') is None ) : continue If child.tag = 'key' and child.text = key : Len INTEGER, rating INTEGER, count INTEGER Id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, # Make some fresh tables using executescript() If you are on a Mac: Don’t forget you need to drag the SQLite icon into your Applications folder. Here is the code using python 3 import as ET The database is modified by adding genre. If name is None or artist is None or album is None or genre_name is None: #connects to database, creates a sqlite fileĬonn = nnect('trackdb1.sqlite') #DB BROWSER FOR SQLITE EXECUTE QUERY CODE# #DB BROWSER FOR SQLITE EXECUTE QUERY CODE#.#DB BROWSER FOR SQLITE EXECUTE QUERY SOFTWARE#.#DB BROWSER FOR SQLITE EXECUTE QUERY UPDATE#.#DB BROWSER FOR SQLITE EXECUTE QUERY ZIP FILE#.#DB BROWSER FOR SQLITE EXECUTE QUERY HOW TO#.
0 Comments
Read More
Leave a Reply. |