Escolar Documentos
Profissional Documentos
Cultura Documentos
1|P ag e
1.Introduction to SQL
Structure Query Language(SQL) is a database query language used for storing and
managing data in Relational DBMS. SQL was the first commercial language introduced
for E.F Cod’s Relational model of database. Today almost all RDBMS(MySQL, Oracle,
Informix, Sybase, MS Access) use SQL as the standard database query language. SQL
is used to perform all types of data operations in RDBMS.
SQL Command
SQL defines following ways to manipulate data stored in an RDBMS.
This includes changes to the structure of the table like creation of table, altering table,
deleting a table etc.
All DDL commands are auto-committed. That means it saves all the changes
permanently in the database.
Command Description
2|P ag e
DML: Data Manipulation Language
DML commands are used for manipulating the data stored in the table and not the table
itself.
DML commands are not auto-committed. It means changes are not permanent to
database, they can be rolled back.
Command Description
These commands are to keep a check on other commands and their affect on the
database. These commands can annul changes made by other commands by rolling the
data back to its original state. It can also make any temporary change permanent.
Command Description
3|P ag e
save point to save temporarily
Data control language are the commands to grant and take back authority from any
database user.
Command Description
Data query language is used to fetch data from tables based on conditions that we can
easily apply.
Command Description
4|P ag e
Experiment – 02
SYNTAX :-
Create table table_name(column1 datatype1,column2 datatype2,…) ;
SYNTAX :-
Insert into table_name(column1,column2,..) values(value1,value2,…) ;
Example:-
SYNTAX :-
Show table_name;
Example:-
5|P ag e
6|P ag e
Experiment- 03
Topic :-TO STUDY USE OF ALTER,DESCRIBE AND DROP
STATEMENT.
Example :-
SYNTAX :-
Alter table table_name drop colum1,column2,..;
Example : -
7|P ag e
8|P ag e
Experiment- 04
Topic :- TO STUDY USE OF Delete and update statement.
1.For deleting a statement :-
SYNTAX :-
DELETE FROM table_name WHERE condition;
Example :-
2.For updating :-
SYNTAX :-
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
Example :-
9|P ag e
Experiment-05
Topic :-TO STUDY USE OF VARIOUS QUERY PROCESSING
STATEMENT.
SYNTAX :-
:- SELECT *from table_name;
Example:-
10 | P a g e
Experiment- 06
Topic :-TO STUDY USE OF VARIOUS CHARACTER
FUNCTION.
Assume-Take string=”sudhanshu”
SYNTAX :-
:- SELECT length(“<your string>”) output from dual;
Example :-
11 | P a g e
Experiment – 07
Topic :- TO STUDY OF THE VARIOUS NUMBER FUNCTION.
SYNTAX :-
:- Select CEIL(value1) output from dual;
Example :-
12 | P a g e
13 | P a g e
Experiment-08
Topic :- .TO STUDY THE USE VARIOUS GROUP
FUNCTION.
SYNTAX :-
:- Select MAX(column1) output from table_name;
Example :-
14 | P a g e
Experiment-09
Topic :-.TO STUDY THE USE OF JOIN FUNCTION.
SQL JOIN
A JOIN clause is used to combine rows from two or more tables, based on a
related column between them.
SYNTAX :-
Select colum1,colum2,..
FROM table1_name JOIN table1_name
ON table1_name.column1 = table2_name.column2;
Example :-
15 | P a g e
16 | P a g e
Experiment-10
Topic :- TO STUDY USE OF SET ORIENTED OPERATION.
• Each SELECT statement within UNION must have the same number of
columns
• The columns must also have similar data types
• The columns in each SELECT statement must also be in the same order
SYNTAX :-
SELECT column_name(s) FROM table1
UNION
SELECT column_name(s) FROM table2;
Example :-
17 | P a g e
18 | P a g e