English subtitles

← Types in the SQL World - Intro to Relational Databases

Get Embed Code
4 Languages

Showing Revision 3 created 05/24/2016 by Udacity Robot.

  1. You saw a lot of examples of
    data types in lesson one.
  2. It may come as no surprise that data
    types are kind of complicated in SQL.
  3. Types in SQL often have different names
    from types in Python or other languages.
  4. And sometimes,
  5. there are distinctions made in SQL
    that other languages don't make.
  6. We'll be working with only a few of
    these types in this course though.
  7. For a whole bunch more types and
  8. links to some documentation with
    even more types, see the next page.
  9. SQL has several different string types.
  10. In this course,
  11. we'll just use the text type, which is
    basically the same as a Python string.
  12. Same goes for numbers.
  13. SQL has number types for
    many different purposes.
  14. But in this course,
    we'll mainly be using the integer type,
  15. which is roughly the same
    as Python's int.
  16. And how about our animals' birth dates?
  17. SQL has date and time types as well.
  18. We'll be using date columns for
  19. birth dates since we don't
    care about the time of day.
  20. One thing that's really important
    to keep in mind about date and
  21. time values in SQL is that you have
    to put single quotes around them
  22. as if they were strings.
  23. If you write 2012-11-23
    inside single quotes,
  24. SQL can interpret that as a date or
    as a piece of text.
  25. But if you write 2012-11-23
    with no quotes around it,
  26. it can only interpret it
    as an integer expression.
  27. It will think you mean
    2,012 minus 11 minus 23,
  28. which equals 1,978,
    which is probably not what you wanted.