Quiz feedback
Posted by sean.smorris on 2009-09-22 01:55
Hey folks, Norman emailed me on his quiz. He does an excellent job of telling what he didn't understand and how he would fix it now. As well as telling, where he is still confused.
Just a good example.
Remember that I am really trying to structure the class so you guys get good at looking and finding the information you need to pull anything off. It might be a bit frustrating at times but the struggle is worth it...
See Norman's email below,
mm
=====
Excellent feedback to me.
On number 7, you are correct because you need to join the tables in order to check length_stay and return ip_address. Don't forget to add the actual join statement to WHERE clause as well.
Make sense?
mm
On Mon, Sep 21, 2009 at 4:20 PM, Norman Zhu <noxzhu@gmail.com> wrote:
On Sat, Sep 19, 2009 at 8:05 PM, Sean Morris <sean.smorris@gmail.com> wrote:
15/20 -- we just need to work on the joins. you are close.
mm
1) The bookid in the genre and author table looks misplaced? see attachment
How would attach the second author to a book? There would be an additional entry to the table "authorbookconnect" with the same book but another author.
2)
1.Write the SQL statement that returns all the fields of all the records from visitors.
SELECT visitors.ip_address, visitors.browser, visits. page_url, visits.length_stay
FROM visitors, visits
WHERE visitors.id_visitors = visits.visitors_id_visitors
>> visitors table only? -1
Misunderstood the question when it said returns "all the fields from all the records from visitors".
Thought it was literally records from people that visit the site, which I took to be data about the visitors, rather than the visitors table, which would simply make it
SELECT * FROM visitors
2.Write the SQL statement that returns the ip_address of all the records with browser equal to “mozilla”.
SELECT ip_address
FROM visitors
WHERE browser = 'mozilla'
3.Write the SQL statement that selects all the fields in the visitors table with browser containing “internet”.
SELECT * FROM visitors
WHERE browser LIKE '%internet%'
4.Write the SQL statement that returns an IP address containing the number 215?
SELECT ip_address FROM visitors WHERE ip_address LIKE '%215%'
5.Write the SQL statement that returns the ip_address, page_url, and length_stay when the ip_address = 213.22.125.23
SELECT ip_address,page_url,length_stay FROM visitors, visits
WHEN visitors.ip_address = '213.22.125.23'
>> join -1
oops, replace WHEN with WHERE
6.Write the SQL statement that will select and return only unique browser names from visitors.
SELECT DISTINCT browser FROM visitors
7.Write the SQL statement that will return only the ip_address of visits whose length of stay are over 20.
SELECT visitors.ip_address FROM visitors WHERE visits.length_stay > 20
>> join -1
thought about it for a few minutes, but I don't quite get it, maybe add "visits" to the FROM list?
Just a good example.
Remember that I am really trying to structure the class so you guys get good at looking and finding the information you need to pull anything off. It might be a bit frustrating at times but the struggle is worth it...
See Norman's email below,
mm
=====
Excellent feedback to me.
On number 7, you are correct because you need to join the tables in order to check length_stay and return ip_address. Don't forget to add the actual join statement to WHERE clause as well.
Make sense?
mm
On Mon, Sep 21, 2009 at 4:20 PM, Norman Zhu <noxzhu@gmail.com> wrote:
On Sat, Sep 19, 2009 at 8:05 PM, Sean Morris <sean.smorris@gmail.com> wrote:
15/20 -- we just need to work on the joins. you are close.
mm
1) The bookid in the genre and author table looks misplaced? see attachment
How would attach the second author to a book? There would be an additional entry to the table "authorbookconnect" with the same book but another author.
2)
1.Write the SQL statement that returns all the fields of all the records from visitors.
SELECT visitors.ip_address, visitors.browser, visits. page_url, visits.length_stay
FROM visitors, visits
WHERE visitors.id_visitors = visits.visitors_id_visitors
>> visitors table only? -1
Misunderstood the question when it said returns "all the fields from all the records from visitors".
Thought it was literally records from people that visit the site, which I took to be data about the visitors, rather than the visitors table, which would simply make it
SELECT * FROM visitors
2.Write the SQL statement that returns the ip_address of all the records with browser equal to “mozilla”.
SELECT ip_address
FROM visitors
WHERE browser = 'mozilla'
3.Write the SQL statement that selects all the fields in the visitors table with browser containing “internet”.
SELECT * FROM visitors
WHERE browser LIKE '%internet%'
4.Write the SQL statement that returns an IP address containing the number 215?
SELECT ip_address FROM visitors WHERE ip_address LIKE '%215%'
5.Write the SQL statement that returns the ip_address, page_url, and length_stay when the ip_address = 213.22.125.23
SELECT ip_address,page_url,length_stay FROM visitors, visits
WHEN visitors.ip_address = '213.22.125.23'
>> join -1
oops, replace WHEN with WHERE
6.Write the SQL statement that will select and return only unique browser names from visitors.
SELECT DISTINCT browser FROM visitors
7.Write the SQL statement that will return only the ip_address of visits whose length of stay are over 20.
SELECT visitors.ip_address FROM visitors WHERE visits.length_stay > 20
>> join -1
thought about it for a few minutes, but I don't quite get it, maybe add "visits" to the FROM list?
Home / Developer API / Tour / Get a Project - Solutions for Bug & Issue Tracking, Collaboration Tools, Subversion Hosting, Git Hosting
Ahs webdev is powered by Assembla.
0 Comments