I don't really know what the deal is with the pragma statement but for some reason it automatically placed it when I used the dump command along with the commit statement. I'm assuming it just removes the foreign key restriction judging from what sqlite.org said.
"As of SQLite version 3.6.19, the default setting for foreign
key enforcement is OFF. However, that might change in a future
release of SQLite. The default setting for foreign key enforcement
can be specified at compile-time using the SQLITE_DEFAULT_FOREIGN_KEYS
preprocessor macro. To minimize future problems, applications should
set the foreign key enforcement flag as required by the application
and not depend on the default setting." http://www.sqlite.org/pragma.html
Tuesday, November 26, 2013
Friday, November 22, 2013
Querying Data
Instead of adding more values I tried querying data because before the results I was getting had a lot of repeating data. I was surprised and very happy to figure out how to restrict results to just one name and one movie. Here are some scripts I made to query data.
This one restricts the search to a person's first name, Hank, and lists their name along with their ID, Title of the movie and its ID.
https://dl.dropboxusercontent.com/u/8028799/movie_query1.sql
This one restricts the search to a person's last name, Krabs, and lists their full name with only the title of the movie.
https://dl.dropboxusercontent.com/u/8028799/movie_query2.sql
This one was difficult to get working but it lists any results whose name starts with an "A" but only shows the movies they like that have an ID less than 8, but it also shows results for people with a last name that starts with "H" and any movie that ends with an "s".
https://dl.dropboxusercontent.com/u/8028799/movie_query3.sql
This one restricts the search to a person's first name, Hank, and lists their name along with their ID, Title of the movie and its ID.
https://dl.dropboxusercontent.com/u/8028799/movie_query1.sql
This one restricts the search to a person's last name, Krabs, and lists their full name with only the title of the movie.
https://dl.dropboxusercontent.com/u/8028799/movie_query2.sql
This one was difficult to get working but it lists any results whose name starts with an "A" but only shows the movies they like that have an ID less than 8, but it also shows results for people with a last name that starts with "H" and any movie that ends with an "s".
https://dl.dropboxusercontent.com/u/8028799/movie_query3.sql
Thursday, November 21, 2013
Movie Database
I added more values mainly to the likes table so the database is basically done now. Also, when I tried to query info I got more data than I wanted but besides that everything is fine.
https://dl.dropboxusercontent.com/u/8028799/movie_likes_insertscript.sql
https://dl.dropboxusercontent.com/u/8028799/movie_likes_insertscript.sql
Wednesday, November 20, 2013
Movie Database
I spent most of the day adding more values to the database and I also messed around with selecting different values. This is the updated insert script.
Insert Code
Insert Code
Tuesday, November 19, 2013
SQL Movie Database
I started on the database for list of movies people like and I got pretty far. I made 2 files, 1 to make the tables and another to insert values. This is it so far.
Tables
Values
When you select the likes table you currently get people's ID's matched with the ID's of movies they like.
sqlite> select * from likes;
3|1
1|2
2|2
3|3
I'll also add some more values later.
Tables
Values
When you select the likes table you currently get people's ID's matched with the ID's of movies they like.
sqlite> select * from likes;
3|1
1|2
2|2
3|3
I'll also add some more values later.
Monday, November 18, 2013
SQL Files
Here is the code for the database:
https://dl.dropboxusercontent.com/u/8028799/export_destination.sql
https://dl.dropboxusercontent.com/u/8028799/product.sql
https://dl.dropboxusercontent.com/u/8028799/sales_statement.sql
https://dl.dropboxusercontent.com/u/8028799/sales.sql
I think it is all working so I will start on that new database ASAP
https://dl.dropboxusercontent.com/u/8028799/export_destination.sql
https://dl.dropboxusercontent.com/u/8028799/product.sql
https://dl.dropboxusercontent.com/u/8028799/sales_statement.sql
https://dl.dropboxusercontent.com/u/8028799/sales.sql
I think it is all working so I will start on that new database ASAP
Thursday, November 14, 2013
SQL
Pretty sure I figured out how to use the dump command and I made some different tables and practiced queering different data. I am excited to write the book and I will try to write the book similar to how you wrote yours because it was very easy to understand your books. I'll try to learn other things that could be relevant to write in the book and I will continue practicing.
Subscribe to:
Posts (Atom)