Lecture Notes
Structured Query Language
❖ SQL is Structured Query Language, which is computer
language for storing, manipulating and retrieving data
stored in relational database.
❖ SQL is the standard language for relation database
system. All relational database management systems like
MySQL, MS Access, Oracle, Sybase, Informix, Postgres
and SQL server use SQL as standard language database.
Types of SQL Command
❑ Data definition language (DDL)
❑ Data manipulation language (DML)
❑ Data control language (DCL)
❑ Transaction control language (TCL)
❑ Data Query Language (DQL) SQL Data Types
Date or Time
Numeric
o Bit
o Tinyint
o Smallint
o In
o Bigint
o Decimal
o Date
o Time
o Datetime
o Timestamp
o Year
Unicode/Character/
String
o Numeric
o Nchar
o Float
o NVarchar
o Real
o Ntext
o NVarchar (Max)
Character or string
o Char
o Varchar
o Text
o Varchar (Max)
Binary
o Varbinary
o Binary
o Image
o Varbinary (Max) Aggregate Function
UPPER ():
This function is used to convert all characters in a string to
uppercase.
Syntax:
MAX ():
This function returns the maximum values in a column.
Syntax: LENGTH ():
This function is t to return the length of a string.
Syntax:
CONTACT ():
This Function is used to concatenate two or more strings
together.
Syntax:
MIN ():
This function returns the minimum value in a column.
Syntax: COUNT ():
This function returns the number of rows in a table or the
number of non-null values in a column.
Syntax:
SUM ():
This function returns the sum of all values in a column.
Syntax:
AVG ():
This function returns the minimum value in a column.
Syntax: GROUP BY ():
This function is used to group the rows in a table based on
the values in one or more columns and performs aggregate
functions on each group.
Syntax:
MIN ():
This function returns the minimum value in a column.
Syntax: