types sql code example

Example 1: sql data types

# Numeric Types
BIT	TINYINT SMALLINT INT BIGINT DECIMAL NUMERIC FLOAT REAL

# Date & Time Types
DATE TIME DATETIME TIMESTAMP YEAR

# Char & String Types (N) Denotes Unicode Versions
CHAR VARCHAR TEXT NCHAR NVARCHAR NTEXT

# Binary Data Types
BINARY VARBINARY IMAGE

# Misc
CLOB BLOB XML JSON

Example 2: data types in sql

• number(num) - whole numbers up to num digits
• number(num,num2) - num whole numbers up to num2 decimals
• char(num) - fixed length character/string
• varchar2(num) - used for varying length data
• date - full date
• currency - used for prices

Example 3: sql types

1- Data Manipulation Language(DML)-(SELECT, INSTERT, UPDATE...)
DML statements affect records in table. These are
basic operations we perform on data such as selecting
few records from a table, inserting new records,
deleting unnecessary records, updating existing records.

2-Data Definition Language (CREATE , ALTER , DROP)...
DDL statements are used to modify database or
table schema. These statements handle the design
and storage of database objects.

3-Data Control Language (GRANT , REVOKE)...
DCL statements control the level of access that
users have on database objects

4- Transaction Control Language (BEGIN TRAN, COMMIT TRAN, ROLLBACK)...

TCL statements allows us to control and manage
transactions to maintain the integrity of data
withing SQL statements.

Tags:

Misc Example