Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 15

THE VELAMMAL INTERNATIONAL SCHOOL

PANCHETTI, CHENNAI – 601 204

AISSCE – 2021-22

Roll No. ______________________


Name :_______________________
Title : _____________________________________

COMPUTER SCIENCE PROJECT

DEPARTMENT OF COMPUTER SCIENCE

2021-2022
THE VELAMMAL INTERNATIONAL SCHOOL

COMPUTER SCIENCE PROJECT

CERTIFICATE
The project report entitled.
“______________________________________________________”

This is to certify that this is the bonafide record of project work done
by Master/ Miss.___________________ of Grade XII during the
academic year 2021-2022.

Submitted for AISSCE -2022 Computer Science Practical Examination


held on _______at The Velammal International School, Panchetti,
Tiruvallur District.

Date: __________

PRINCIPAL INTERNAL EXAMINER EXTERNAL EXAMINER


DECLARATION

I hereby declare that the project work entitled


“____________________________________________”,
submitted to Department of Computer Science, The
Velammal International School is prepared by me and my
team. All the coding is result of my team personal
efforts.

_______________

Class XII CSC


ACKNOWLEDGEMENT

First of all we thank our beloved parents for providing us the opportunity to study in The
Velammal International School.

We thank our beloved Director Sri. M.V.M SASIKUMAR for being our motivational
force for the completion of this project.

We thank our Principal’s Sri. G. PRABHAKARAN & Sri. S. MADHAVA


KRISHNA for his exceptional support.

We thank our Computer Science Department HOD Smt.K.HEMALATHA SRI and

our teachers Smt. N.LAVANYA, Smt. P.S.SINDHU, Mr CH BALA

SUBRAMANYAM, Mr K KISHORE BABU, Mr A JAGADEESHWARAN for

encouraging and guiding us to complete this project.

Last but not the least I thank all my friends who helped me in the completion of this
project.
CONTENTS

1. INTRODUCTION TO PYTHON

2. PROJECT ON ______________________________

3. INTRODUCTION OBJECTIVES OF THE

PROJECT HARDWARE AND SOFTWARE

REQUIREMENTS

4. PROPOSED SYSTEM BACKEND DETAILS

WORKING DESCRIPTION

5.CODING

6. SCREEN SHOTS OF EXECUTION

7. BIBLIOGRAPHY

5
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, and 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.

6
 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 –

 It supports functional and structured programming methods as well as OOP.

 It can be used as a scripting language or can be compiled to byte-code for


building large applications.

 It provides very high-level dynamic data types and supports dynamic type
checking.

 It supports automatic garbage collection.

 It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

DATA FILE HANDLING IN PYTHON:

A file is a sequence of bytes on the disk/permanent storage where a group of related


data is stored. File is created for permanent storage of data. In programming, Sometimes, it
is not enough to only display the data on the console. Those data are to be retrieved later on,
7
and then the concept of file handling comes. It is impossible to recover the programmatically
generated data again and again. However, if we need to do so, we may store it onto the file

system which is not volatile and can be accessed every time. Here, comes the need of file
handling in Python. File handling in Python enables us to create, update, read, and delete the
files stored on the file system through our python program.

The following operations can be performed on a file. In Python, File Handling consists of
following three steps:

 Open the file.

 Process file i.e. perform read or write operation.

 Close the file.

TYPES OF FILE

There are two types of files:

Text Files- A file whose contents can be viewed using a text editor is called a text file. A
text file is simply a sequence of ASCII or Unicode characters. Python programs, contents
written in text editors are some of the example of text files.

Binary Files-A binary file stores the data in the same way as stored in the memory.
The .exe files, mp3 file, image files, word documents are some of the examples of binary
files. We can’t read a binary file using a text editor.

CSV Files: A Comma Separated Values (CSV) file is a plain text file that contains a list of
data. These files are often used for exchanging data between different applications. For
example, databases and contact managers often support CSV files.These files may sometimes
be called Character Separated Values or Comma Delimited files. They mostly use the comma
character to separate (or delimit) data, but sometimes use other characters, like semicolons.

8
SQL (Structured Query Language) :

It is a standard language for accessing and manipulating databases.SQL commands are


used to create, transform and retrieve information from Relational Database
Management Systems.They are also used to create interface between user and
database.In Relational database Model all the information is stored on Tables, these
tables are divided into rows and columns. A collection on related tables are called
DATABASE. A named table in a database is called RELATION in Relational Data
Model. Row in a table is called TUPLES, and column of a Table are called
ATTRIBUTE. No. of rows in a table is called DEGREE of the table and no. of columns
in a tables in called CARDINALITY.

Primary Key : An attribute or a group of attribute which can distinguish a row


uniquely in a table is Called Primary key/Key Field/Key attribute.
Candidate key : The attributes which are capable to act as a primary key is
known as candidate key.
Alternate key : An attribute which can act as a primary key in place of primary
key as called alternate key.
Foreign Key : An attribute in its present table whose values are derived from some
other table, is called foreign key in the present table.

Create Table: This DDL command is used to create a new table into any existing
database. The syntax of this command is as follows:
Syntax:

Create table <tblname> ( column_name datatype size constraints ,


column_name datatype size constraints , column_name datatype size constraints ,);
Example :
Sql> Create table student ( admno number(4) , roll number(2), Name char(30),
fname char(30), DOB date, Address varchar(80) );
9
To see the structure of the above defined table is as follows
Sql> desc student ;

ALTER TABLE: This DDL command is used to add / modify a column in any
existing table of a database.
The syntax of this command is as follows:
Syntax:
Alter table <tablename> ADD/MODIFY/DROP ( column_name datatype size
constraints , column_name datatype size constraints , column_name datatype size
constraints , );
Example:
Task : To add a new column “ Phone “ having datatype char and size 12 in a table
student
Sql > alter table student ADD ( phone char (12)) ;
Task : To change the datatype of admno into char and increase the size as 5
Sql > alter table student MODIFY ( admno char(5));
Task : Delete a column DOB from the table student
Sql > alter table student drop DOB;
Drop Table ; This DDL command is used to remove a table from any existing
database.
This syntax of this command is as follows
Syntax
Drop table < table name>
Example
Sql> drop table student ;

INSERT COMMAND : This DML command is used to add a new row

( record/ tuple ) in any existing

database table . The syntax is as follows

10
Syntax :

insert into < table name > values ( value1, value2, value 3,. value N );

Example :

Task : Add a new row in a table student ( which we have created earlier)

Sql > Insert into student values ( ‘1234A’,12, ‘joshin gulati’,’’abcd’, ‘9-apr-2008’,

’b-152 surya agar’);

SELECT COMMAND : This DML command is used to retrieve information from any

table (s) to display/ list/ report on the screen, but this command cannot any how update/

modify any table.

The syntax of this command is as follows

Syntax : Select [ * / column list ] from < table name> [ where < condition > ]

[ order by < col name..> [asc/desc] ] [ group by < col name>]

Examples:

Task : To display all the records of table EMP

Sql > select * from EMP;

Task : To display only the employee no and employee name

Sql > select empno , ename from EMP;

Where clause : it is used to restrict the no no of rows from being displayed on the screen

Task : display all the employees whose salary is greater than 1500

Sql > select * from emp where sal > 1500;

Update : This DML command is used to change/modify the record(s) of any table.

The syntax is as follows

Syntax

Update < tablename>


11
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 o f 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 it’s 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>

12
Example

Drop view abc;

Interface Python with MySQL :

 Databases play a vital role in the efficient working of an organization.

 They are essentially collection of tables and are connected with each other through

columns.

 These database systems support SQL, which is used to create,access and manipulate data.

 The python programming language has powerful features for database programming.

 Python support various database servers like MySQL,Oracle,Sybase,mSQL,Microsoft

SQL server 2000 etc.

 For database programming the python DB-API is a widely used module that provides a

database application programming interface.

 It is a standard for database interface.

PYTHON - MYSQL CONNECTIVITY:

 Usually the data inputted by the user along with the generated output is displayed but

not stored because all execution takes place in RAM which is a temporary memory and

as soon as we close the form, its contents gets erased.

 Thus, when the application is executed the second time,it requires a new set of inputs

from the user.

 This can be overcome by sending the output generated and saving the input fetched from

the user in a database created at the back end of the application.

 The input is fetched from the user using python interface.This is known as FRONT END

interface of the application.

 An application usually stores a lot of data in the form of a database which is not directly

accessible by the user.

 This database is used by the application to give suitable response to the user, This

13
database is called BACK-END databases.

Some important points are as follows:

o To connect to a database from within a programming application, you need a

framework that facilitates communication between two different genres of

software (programming application and DBMS).

o To connect front Python to MYSQL, you need a library called MySQL

connector.

o You must import mysql.connector in the Python program/script before writing

code of connectivity.

o Steps to create a database connectivity Python application are:

Step 1. Start Python: start Python’s editor where you can create your python scripts,

i.e; IDLE.

Step 2. Import the package required for database programming.

Here you need to import mysql.connector package in your python scripts.

Step 3. Open a connection: Here we need to establish a connection to MYSQL

database using connect(). This requires 4 parameters, the syntax for this is as follows:

<Connection_object> = mysql.connector.connect(host= <host_name>, user=

<username>, passwd =<password> , [database = <databasename>])

Example:

import mysql.connector as m

mydb = m.connect(host =”Iocalhost” , user = ”root", passwd = ”admin", database =”test”)

Step 4. Create a cursor instance.

Here we have to create an instance of cursor by using cursor(), the syntax for the following

is as follows:

<cursorobject> =<connectionobject>.cursor()

i.e; in the above connection we can create cursor() by writing:

mycursor = mydb.cursor()
14
Step 5: Execute a query. Here we use be 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 resultset 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 resultset, i.e., the set of records retrieved as per query.

• The resultset refers to a logical set of records that are fetched from the database by

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).

15

You might also like