BLAL CS
BLAL CS
A Project Report On
“ ”
Submitted By
Roll No:
Name: U. BALA GANESAN
Class: XII
Ms. RAJALAKASHMI
TEACHER IN-CHARGE
BALA GANESAN
➢ INTRODUCTION TO PYTHON
➢ INTRODUCTION
Thft
➢ OBJECTIVES
➢ SYSTEM REQUIREMENTS
➢ FRONTEND DETAILS
➢ SCREENSHOTS OF EXECUTION
➢ BIBLIOGRAPHY
INTRODUCTION TO PYTHON
Python is an interpreter, object-oriented, high-level programming language
with dynamic semantics. Its high-level built in data structures, combined with
dynamic typing and dynamic binding; make it very attractive for Rapid Application
Development, as well as for use as a scripting or glue language to connect existing
components together. Python's simple, easy to learn syntax emphasizes readability
and therefore reduces the cost of program maintenance.
Python supports modules and packages, which encourages program
modularity and code reuse. The Python interpreter and the extensive standard library
are available in source or binary form without charge for all major platforms and
can be freely distributed.
History of Python
Python was developed by Guido van Rossum in the late eighties and early
nineties at the National Research Institute for Mathematics and Computer Science
in the Netherlands. Python is derived from many other languages, including ABC,
Modula-3, C, C++, Algol-68, Smalltalk, Unix shell and other scripting languages.
Python is copyrighted. Like Perl, Python source code is now available under
the GNU General Public License (GPL). Python is now maintained by a core
development team at the institute, although Guido van Rossum still holds a vital
role in directing its progress.
Python Features
● Easy-to-learn − Python has few keywords, simple structure, and a clearly
defined syntax. This allows the student to pick up the language quickly.
● Easy-to-read − Python code is more clearly defined and visible to the eyes.
● Easy-to-maintain − Python's source code is fairly easy-to-maintain.
● A broad standard library − Python's bulk of the library is very portable and
cross-platform compatible on UNIX, Windows, and Macintosh.
● Interactive Mode − Python has support for an interactive mode which
allows interactive testing and debugging of snippets of code.
● Portable − Python can run on a wide variety of hardware platforms and has
the same interface on all platforms.
● Extendable − You can add low-level modules to the Python interpreter.
These modules enable programmers to add to or customize their tools to be
more efficient.
● Databases − Python provides interfaces to all major commercial databases.
● GUI Programming − Python supports GUI applications that can be created
and ported to many system calls, libraries and windows systems, such as
Windows MFC, Macintosh, and the X Window system of Unix.
● Scalable − Python provides a better structure and support for large programs
than shell scripting.
Apart from the above-mentioned features, Python has a big list of
good features, few are listed below: –
Task: To change the datatype of admno into char and increase the size as 5
Drop Table: This DDL command is used to remove a table from any existing
database.
Syntax:
Drop table < table name>
Example:
Sql> drop table student;
Update: This DML command is used to change/modify the record(s) of any table.
The syntax is as follows
Syntax:
Update < tablename> Set column Name = value [ where < condition>]
Example:
1. Update emp
Set sal = sal + sal * 0.05; (Give an increment of 5 % to each employee )
2. update emp
set sal = sal+ sal * 0.05
where job =’PRESIDENT’; (Give an increment of 5% to president only)
DELETE: This DML command is used to delete a row/ tuple(s) from a table.
The Syntax is as follows,
Syntax:
DELETE from <tablename > [ where < condition >]
Example
1. Delete from emp ; ( delete all the records leaving its structure intact)
2. Delete from emp where sal >=3000 ;
Create View: This Command is used to create a new View in any existing database.
The syntax is as follows:
Syntax:
Create view < viewname> As Select command
Example:
create view abc as select empno,job,sal from emp;
Drop View : This command is used to drop any existing view from the database.
The syntax is as follows,
Syntax:
Drop View < viewname>
Example:
Drop view abc;
mycursor = mydb.cursor()
Step 5: Execute a query. Here we use the execute() with following syntax.
< cursorobject>.execute(‹sql query strings)
i.e; mycursor.execute("select * from data”)
Step 6: Extract data from result set. Here you can fetch the data from the result set by
using fetch( ) functions.
[fetchall(), fetchmany(<n>), fetchone()]
Step 7. Clean up the environment.
● A database Connection object controls the connection to the database.
It represents a unique session with a database connected from within a
script/program.
● A Database Cursor is a special control structure that facilitates the row-by-row
processing of records in the results set, i.e., the set of records retrieved as per
query.
● The results set refers to a logical set of records that are fetched from the
databaseby executing an SQL query and made available to the application
program.
● You can use connect() method for establishing database connection. cursor() to create
a cursor and execute() to execute an SQL query.
● For INSERT, UPDATE and DELETE queries, you must run commit() with the
connection object (Here that is mydb).
OBJECTIVES
HARDWARE REQUIREMENTS
SOFTWARE REQUIREMENTS