Integer Types
Represent positive and negative whole numbers.
Decimal Types
Represent numbers with fractional values.
Character Types
Represent textual data (e.g., letters, words).
Time Types
Represent date and time values or both.
Binary Types
Store data exactly as it appears in memory or files, bit for bit.
Semantic Types
Based on other types, with additional special meanings.
Simple Data Types
Have simple internal structures and are easy to understand.
Spatial Types
Store geometric information such as lines, polygons, and map coordinates.
Composite Types
Support collections of different values, usually organized in sets or arrays.
Document Types
Contain textual data in a structured format, for example, XML or JSON.
Object Types
Enable object-oriented programming capabilities (e.g., methods, subclasses).
System-Defined Types
Built-in types provided by the database systems (e.g., FLOAT, CHAR, ENUM, SET).
User-Defined Types
Created by database designers to meet specific application needs using the CREATE TYPE
statement.
Example statements:
CREATE TYPE Size AS ENUM ('Small', 'Medium', 'Large', 'XLarge');
Used in tables as:
CREATE TABLE Clothing (
ItemNumber INTEGER,
ItemName VARCHAR(20),
ItemSize Size
);
INSERT INTO Clothing VALUES (3281, 'Sahara sun bonnet', 'Small');
INSERT INTO Clothing VALUES (3400, 'Zephyr shorts', 'XLarge');
CREATE TYPE
CREATE TYPE
allows for defining new types based on existing system-defined types.
User-defined types can be used in table definitions.
Which database does not support the CREATE TYPE statement?
Answer: MySQL
User-defined types can be:
Answer: Either simple or complex types.
System-defined types can be:
Answer: Either simple or complex types.
Simple Types: INTEGER, DECIMAL
Complex Types: JSON, XML