Professional Documents
Culture Documents
Practical File Of: Python Practicals
Practical File Of: Python Practicals
KUMAR
SINGH
19CSE001
PRACTICAL FILE OF
Python Practicals
3rd Sem
PROGRAM-1
AIM:- Creating of a database and writing SQL
queries to retrieve information from the database.
CREATE-
Rollnum int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);
Retrieve:
city varchar(500)
);
PROGRAM-2
AIM:- Performing Insertion, Deletion, Modifying Altering,
Updating and Viewing records based on conditions.
CREATE- Insertion
insert into Persons
(Rollnum ,LastName,FirstName ,Address ,City )
CREATE- Deletion
delete from PERSONS
OUTPUT-
CREATE-Updating.
UPDATE PERSONS
SET FirstName = 'Alfred Schmidt', City= 'Frankfurt'
WHERE Rollnum = 50;
PROGRAM-3
AIM:- Creation of Views, Synonyms, Sequence, Indexes,
Save point.
CREATE- Creation of Views.
VIEW: A view is simply the representation of a SQL statement that is stored in memory so
that it can easily be re-used. Its also referred as logical table.
SYNTAX: CREATE OR REPLACE VIEW <view name> AS < select statement >
#Creation of Synonyms.
SYNONYM: A synonym is an alias or alternate name for a table, view, sequence, or other
schema object. They are used mainly to make it easy for users to access database objects
owned by other users.
#Creation of Sequence.
SEQUENCE: A sequence is a database object from which multiple users may generate
unique integers. User can use sequences to automatically generate primary key values
* Create a sequence to generate unique value for empid eld in the employee table while
inserting
fi
#Creation of Indexes.
INDEXES: Database system uses indexes to avoid the need for large-table, full-table scans
and disk sorts, which are required when the SQL optimizer cannot nd an ef cient way to
service the SQL query.
SYNTAX: CREATE INDEX <INDEX-NAME>ON <table-name(attribute)
OUTPUT:
Index Created.
fi
fi
>
PROGRAM-4
AIM:- Creating an Employee database to set various
constraints.