Summary
Keywords
Full Transcript
There are 6 main categories of simple data types: Integer – whole numbers, positive or negative Decimal - floating point numbers, numbers with a decimal or fractional-value Character – Text characters that are fixed or varied lengths Time – date, time, or datetime, and may include time zone. Can also be a time interval Binary – 1s and 0s, just like the data stored in memory or on computer files Sematic – types that have a special meaning, such as BOOLEAN (1 is true and 0 is false), ENUM for enumerated values (like red yellow green for traffic lights), and MONEY for currency representation There are 4 main categories of complex data types: Collection – similar type of data organized in a collection such as a set or array Document – text data, typically JSON or XML Spatial - geometric information, such as lines, polygons, and map coordinates. Object – object-oriented programming constructs There are also system-defined types (built-in types). For example, MySQL has: FLOAT, CHAR, ENUM, SET, JSON, and POINT You can also create your own user-defined type using CREATE TYPE statement and specifying the name of the type and a base type which can be user or system defined. Example: CREATE TYPE Points AS INT. Creates a new type called Points with base type as an integer. Even though Points is an INT, you cannot compare it to something that is of type INT anymore since it’s now a different type. Note that MySQL does not support the CREATE TYPE statement, but Oracle, PostgreSQL, DB2, and SQL Server does. Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!
