SQL


SQL(Structured Query Language):

Table of Contents:

    1. About SQL

    2. SQL Datatypes


1.About SQL

SQL:

1)SQL stands for Structured Query Language. It is used for storing and managing data in relational database management system (RDMS).

2)It is a standard language for Relational Database System. It enables a user to create, read, update and delete relational databases and tables.

Rules:

1)Structure query language is not case sensitive. Generally, keywords of SQL are written in uppercase.

2)Statements of SQL are dependent on text lines. We can use a single SQL statement on one or multiple text line.

3)Using the SQL statements, you can perform most of the actions in a database.

4)SQL depends on tuple relational calculus and relational algebra.

Characteristics of SQL:

1)SQL is easy to learn.

2)SQL is used to access data from relational database management systems.

3)SQL can execute queries against the database.

4)SQL is used to describe the data.

Advantages of SQL:

1)High speed:
Using the SQL queries, the user can quickly and efficiently retrieve a large amount of records from a database.

2)No coding needed:
In the standard SQL, it is very easy to manage the database system. It doesn't require a substantial amount of code to manage the database system.

3)Portability:
SQL can be used in laptop, PCs, server and even some mobile phones.

4)Interactive language:
SQL is a domain language used to communicate with the database. It is also used to receive answers to the complex questions in seconds.

2.SQL Datatypes:

a)Numeric data types:
These are used to store numeric values. Examples include INT, BIGINT, DECIMAL, and FLOAT.

b)Character data types:
These are used to store character strings. Examples include CHAR, VARCHAR, and TEXT.

c)Date and time data types:
These are used to store date and time values. Examples include DATE, TIME, and TIMESTAMP.

d)Binary data types:
These are used to store binary data, such as images or audio files. Examples include BLOB and BYTEA.

e)Boolean data type:
This data type is used to store logical values. The only possible values are TRUE and FALSE.

f)Interval data types:
These are used to store intervals of time. Examples include INTERVAL YEAR, INTERVAL MONTH, and INTERVAL DAY.

g)Array data types:
These are used to store arrays of values. Examples include ARRAY and JSON.

h)XML data type:
This data type is used to store XML data.

i)Spatial data types:
These are used to store geometric or geographic data. Examples include POINT, LINE, and POLYGON.

A brief idea of all the datatypes is discussed below:

Binary Datatypes:
a)Binary
b)varbinary
c)varbinary(max)
d)image

Exact Numeric Datatype:
a)BigInt
b)Int
c)smallint
d)tinyint
e)bit
f)decimal
g)numeric
h)money 
i)smallmoney

Approximate Numeric Datatype:
a)Float
b)Real

Character String Datatype:
a)char
b)varchar
c)varchar(max)
d)text

Date and Time Datatype:
a)DATE
b)TIME
c)DATETIME

Unicode Character String Datatype:
a)nchar
b)nvarchar
c)nvarchar(max)

Post a Comment

Previous Post Next Post

Contact Form