Prior to the start, we downloaded a sample database, which we then used to answer a number of queries, such as create a list of all orders shipped after a certain date. I was happy enough with how that part of the test went, though looking at the results a few weeks later, I had made a few more stupid mistakes than I thought at the time.
The second part of the test involved writing queries for a database whose structure was described in a diagram. Again, I felt this was going well until the last question where we were asked to return details of all suppliers that supply a product with a productid of 33. Both my brain & Google decided to give up on me at that stage, so I went for this answer:
select * from Suppliers where Products.ProductID = 33 Inner Join Products on Suppliers.SupplierID = Products.SupplierID;
when I should have used this:
select suppliers.companyname, suppliers.contactname, suppliers.contacttitle from suppliers, products where suppliers.supplierid = products.supplierid and products.productid = 33;
It's still an area that I need to go back to at some stage to make sure I fully understand what happens in each query. Since the test though, it's been project proposals & project work almost non-stop, so it'll be another while before I get to look at it again.
No comments:
Post a Comment