Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← GQL - Web Development

Get Embed Code
4 Languages

Showing Revision 10 created 05/25/2016 by Udacity Robot.

  1. Okay. Another difference is, in this class, we've been talking about SQL
  2. and in the app store, we've got something a little different.
  3. It's called "G-quel"--GQL
  4. and it's basically a simplified version of SQL
  5. that works only in the Datastore.
  6. And the main difference is
  7. all queries begin with SELECT*
  8. so there's no way to select individual columns--
  9. So this actually simplifies a lot of queries we can do.
  10. For example, we can't do joins,
  11. which is why I didn't want to spend a whole lot of
  12. time on joins earlier.
  13. Even if I were working in a SQL database,
  14. I probably wouldn't be doing a whole lot of joins
  15. and in the App Engine Datastore,
  16. we won't be doing any joins whatsoever because it's not possible.
  17. When we're using GQL--
  18. actually, we don't even have to use GQL at all.
  19. The Datastore has a kind of procedural language you could use as well.
  20. But since we've spent all this time practicing SQL
  21. and you'll probably use it elsewhere in your career,
  22. we're going to use GQL for this example.
  23. So we can at least have some consistency there.
  24. Another difference is in a kind of generic
  25. SQL database, as we've been talking about.
  26. You can run arbitrary queries--
  27. no matter how slow, with or without indices.
  28. And in App Engine, all queries must be indexed.
  29. This is important, right--because
  30. when you're running your own database, you can do whatever you want.
  31. But Google--it's very nice of them to give us this whole system for free--
  32. at least for small-use cases--
  33. but we can't beat their machines to death.
  34. All the queries must be indexed.
  35. It's actually not just so we don't beat them to death
  36. but it's just the way the whole system is built.
  37. As you get more familiar with it, it'll kind of make sense--
  38. why things are designed the way they are.
  39. So for the most part, in this example
  40. that I'm going to build and your homework,
  41. you won't actually have to build any indices yourself.
  42. Google App Engine will actually build the indices for you,
  43. which is really handy.
  44. If you wanted control over what indices they build--
  45. yes, you can do that yourself.
  46. Sometimes, it might build, not the most efficient index,
  47. and you can define your own--so that's pretty cool as well.