Practical 2 1.PDF.pdf
Practical 2 1.PDF.pdf
Subject : DBMSL
Class : TE COMP
Batch : T2
Roll no : 0031
Date Of Submission :
Remarks :
ASSIGNMENT 2
• Date Of Completion :
• Problem Statement :
Design and Develop SQL DDL statements which demonstrate the use of SQL
objects such as Table, View, Index, Sequence, Synonym, different constraints
Write at least 10 SQL queries on the suitable database application using SQL
DML statements.
• Theory :
1. Table :
Various operations that can be performed on a table are
create,drop,delete,modify,alter,add column,add constraint.
2. View :
Views in SQL are a kind of virtual table. A view also has rows and
columns like tables, but a view doesn’t store data on the disk like a
table. A view defines a customized query that retrieves data from one
or more tables and represents the data as if it was coming from a
single source.
4.Index :
5.Synonym :
• SQL Queries :
1.Create Table :
Syntax :
... [table_constraints] );
Example :
Name VARCHAR(50),
Address VARCHAR(30),
Register_Date DATE,
UNIQUE (Phone_Number)
);
2.Create View
Syntax :
FROM table_name
WHERE condition;
Example :
3.Drop Table
Syntax :
Example :
4.Drop Column
Syntax :
Example :
5.Truncate
Syntax :
Example :
Syntax:
7.Create Index
Example :
ON Customer (Phone_Number);
8.Create Synonyms :
Syntax :
FOR schema_name.object_name;
Example :
FOR hr.employees;
9.Create Sequence
Syntax :
[ INCREMENT BY increment_value ]
[ MAXVALUE max_value ]
[ MINVALUE min_value ]
[ CYCLE | NOCYCLE ]
Example :
START WITH 1
INCREMENT BY 1;
10.Add a column
Syntax :
Example :