
readmore
This blog is not a political blog, the rest of content is about Python Programming.It is also NOT for Python the Snake
Return a result record of the query
For example:for row in cur.fetchall( ):
- fetchall( ) - return all as a tuple
print "name",row[0], "address",row[1]
2. fetchone( ) - return first row
for row in cur.fetchone( ):
print "............................
3. fetchmany( size) - return row according to size
for row in cur.fetchmany(200)
print "%s | %s |%s" %row
name_last age
------------------------------------------------------------------------------
Putin 51
Lebed 53
Zhirinovsky 57
Yeltsin 72
Database is a structured collection of data that is stored in a computer. A computer program, that manages and queries a database is calles a Database Management System (DBMS). Some thirty years ago, DBMS were available only in the research laboratories of giant companies like IBM. Later on, they began to spread. But they were very expensive. These days, we can found DBMS everywhere. On the web, on our personal computers, in various mobile devices or portables. We can have many different databeses for little or no money that would cost thousands of dollars in the past. We live in interesting times.
There are various database models. The most significant database model is the relational database model (RDBMS). The data is divided into tables. Among these tables we define relations. We all have heard about various database management systems. There are several well known commercial DBMS as well as open source ones.
Commercial RDBMS
| Opensource RDBMS
|
Starting from Python 2.5.x series, an SQLite library is included in the python language. SQLite is a small embeddable library. This means that programmers can integrate the libraty inside their applications. No server is needed to work with SQLite. Therefore SQLite is also called a zero-configuration SQL database engine.
SQLite has the following features.
SQLite supports these data types:
Before we start working with SQLite, we define some important terms. A database query is a search for information from a database. A query is written in SQL language. Structured Query Language (SQL) is a computer language used to create, retrieve, update and delete data from the database. It was developed by the IBM corporation. SQL language has three subsets.