Question

First, load the tables into sqlite3. If you're on Windows or Mac OS X (Mavericks or...

First, load the tables into sqlite3. If you're on Windows or Mac OS X (Mavericks or older), use the following command:

$ ./sqlite3 --init lab12.sql

If you're on Ubuntu or Mac OS X (Yosemite or newer), use:

$ sqlite3 --init lab12.sql

Before we start, inspect the schema of the tables that we've created for you:

sqlite> .schema

A schema tells you the name of each of our tables and their attributes. In general, you can think of a schema as a map that describes the logical entities and relationships of a database. Just as the outline of a book tells a reader the order and category in which content is organized, a schema details the organizational hierarchy of information within a database.

Let's also take a look at some of the entries in our table. There are a lot of entries though, so let's just output the first 20:

sqlite> SELECT * FROM students LIMIT 20;

If you're curious about some of the answers students put into the Google form, open up data.sql in your favorite text editor and take a look!

For each of the SQL queries below, decide to yourself and/or your partner what the query is looking for, then try running the query yourself and see!

sqlite> SELECT * FROM students; -- This is a comment. * is shorthand for all columns!

______

sqlite> SELECT color FROM students WHERE number = 16;

______

sqlite> SELECT song, pet FROM students WHERE color = "blue" AND date = "12/25";

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1,sqlite> SELECT color FROM students WHERE number = 16;

Ans: This query will display all the colors in table "students" which have value of number as 16.

2.sqlite> SELECT song, pet FROM students WHERE color = "blue" AND date = "12/25";

Ans: This will display all songs and pet value pair from table students where color is "blue" and date is "12/25"

**If you have any query , please feel free to comment with details.
**Happy learning :)

Add a comment
Answer #2

Q:sqlite> SELECT color FROM students WHERE number = 16;
A: This query will display all the values of the column named "color" under "students" table which have a number of "16"
___
Q:sqlite> SELECT song, pet FROM students WHERE color = "blue" AND date = "12/25";
A: This query will display the values of song & pet column in "students" table which have the value of color is equal to blue & date is equal to "12/25"
Add a comment
Know the answer?
Add Answer to:
First, load the tables into sqlite3. If you're on Windows or Mac OS X (Mavericks or...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT