UNIT III – DATABASE MANAGEMENT
STRUCTURED QUERY LANGUAGE(SQL)
SQL : PART 1
MySQL: It is a freely available open source Relational Database Management System (RDBMS) that uses
Structured Query Language (SQL).
Advantages / characteristics of using SQL:
1. It is very easy to learn and use.
2. Large volume of databases can be handled quite easily.
3. It is a nonprocedural language. It means that we do not need to specify the procedures to accomplish
a task but just to give a command to perform the activity.
4. SQL can be linked to most of other high level languages that makes it first choice for the database
programmers.
Processing Capabilities of SQL:
1. Data Definition Language
2. Data Manipulation Language
3. Data Control Language
4. Transaction Control Language
Data Types of SQL :
Like any other programming language , the facility of defining data of various types is available in SQL
also. The most common data types of SQL are
int/integer, float/ decimal , char/varchar , date
1. int - int specifies an integer value. Each int value occupies 4 bytes of storage. To represent larger
values use bigint, which occupies 8 bytes.
Eg) Admno int
2. float - It holds numbers with decimal points. Each float value occupies 4 bytes
Eg) Marks float
[ DECIMAL(n,d)
Where n specifies the total number of digits and d specifies the number of digits to
the right of the decimal.
Eg: Marks DECIMAL(5,2)
Declares marks to be of type float with maximum 3 digits in integer part and 2
digits in decimal part ]
3. char(n)
Specifies character type data of length n, where n could be any value from 0 to 255.
char is of fixed length.
char(10) reserve spaces for 10 characters .If data does not have 10 characters ,MySQL fills the
remaining characters with
spaces padded on the right.
Eg: name char(25)
Declares name of type character of upto 25 size long.
4. varchar(n)
Specifies character type data of length n, where n could be any value from 0 to 65535.
varchar is a variable length data type.
STRUCTURED QUERY LANGUAGE(SQL)
SQL : PART 1
MySQL: It is a freely available open source Relational Database Management System (RDBMS) that uses
Structured Query Language (SQL).
Advantages / characteristics of using SQL:
1. It is very easy to learn and use.
2. Large volume of databases can be handled quite easily.
3. It is a nonprocedural language. It means that we do not need to specify the procedures to accomplish
a task but just to give a command to perform the activity.
4. SQL can be linked to most of other high level languages that makes it first choice for the database
programmers.
Processing Capabilities of SQL:
1. Data Definition Language
2. Data Manipulation Language
3. Data Control Language
4. Transaction Control Language
Data Types of SQL :
Like any other programming language , the facility of defining data of various types is available in SQL
also. The most common data types of SQL are
int/integer, float/ decimal , char/varchar , date
1. int - int specifies an integer value. Each int value occupies 4 bytes of storage. To represent larger
values use bigint, which occupies 8 bytes.
Eg) Admno int
2. float - It holds numbers with decimal points. Each float value occupies 4 bytes
Eg) Marks float
[ DECIMAL(n,d)
Where n specifies the total number of digits and d specifies the number of digits to
the right of the decimal.
Eg: Marks DECIMAL(5,2)
Declares marks to be of type float with maximum 3 digits in integer part and 2
digits in decimal part ]
3. char(n)
Specifies character type data of length n, where n could be any value from 0 to 255.
char is of fixed length.
char(10) reserve spaces for 10 characters .If data does not have 10 characters ,MySQL fills the
remaining characters with
spaces padded on the right.
Eg: name char(25)
Declares name of type character of upto 25 size long.
4. varchar(n)
Specifies character type data of length n, where n could be any value from 0 to 65535.
varchar is a variable length data type.