- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Mohd Mohtashim has Published 251 Articles
![Mohd Mohtashim](https://www.tutorialspoint.com/assets/profiles/152429/profile/60_230655-1575021953.jpg)
Mohd Mohtashim
206 Views
DELETE operation is required when you want to delete some records from your database. Following is the procedure to delete all the records from EMPLOYEE where AGE is more than 20 −Example#!/usr/bin/python import MySQLdb # Open database connection db = MySQLdb.connect("localhost", "testuser", "test123", "TESTDB" ) # prepare a cursor object ... Read More
![Mohd Mohtashim](https://www.tutorialspoint.com/assets/profiles/152429/profile/60_230655-1575021953.jpg)
Mohd Mohtashim
376 Views
UPDATE Operation on any database means to update one or more records, which are already available in the database.The following procedure updates all the records having SEX as 'M'. Here, we increase AGE of all the males by one year.Example#!/usr/bin/python import MySQLdb # Open database connection db = MySQLdb.connect("localhost", "testuser", "test123", ... Read More
![Mohd Mohtashim](https://www.tutorialspoint.com/assets/profiles/152429/profile/60_230655-1575021953.jpg)
Mohd Mohtashim
587 Views
READ Operation on any database means to fetch some useful information from the database.Once our database connection is established, you are ready to make a query into this database. You can use either fetchone() method to fetch single record or fetchall() method to fetech multiple values from a database table.fetchone() ... Read More
![Mohd Mohtashim](https://www.tutorialspoint.com/assets/profiles/152429/profile/60_230655-1575021953.jpg)
Mohd Mohtashim
401 Views
It is required when you want to create your records into a database table.ExampleThe following example, executes SQL INSERT statement to create a record into EMPLOYEE table −#!/usr/bin/python import MySQLdb # Open database connection db = MySQLdb.connect("localhost", "testuser", "test123", "TESTDB" ) # prepare a cursor object using cursor() method cursor = db.cursor() ... Read More
![Mohd Mohtashim](https://www.tutorialspoint.com/assets/profiles/152429/profile/60_230655-1575021953.jpg)
Mohd Mohtashim
306 Views
Once a database connection is established, we are ready to create tables or records into the database tables using execute method of the created cursor.ExampleLet us create Database table EMPLOYEE −#!/usr/bin/python import MySQLdb # Open database connection db = MySQLdb.connect("localhost", "testuser", "test123", "TESTDB" ) # prepare a cursor object using cursor() method ... Read More
![Mohd Mohtashim](https://www.tutorialspoint.com/assets/profiles/152429/profile/60_230655-1575021953.jpg)
Mohd Mohtashim
544 Views
Before connecting to a MySQL database, make sure of the followings −You have created a database TESTDB.You have created a table EMPLOYEE in TESTDB.This table has fields FIRST_NAME, LAST_NAME, AGE, SEX and INCOME.User ID "testuser" and password "test123" are set to access TESTDB.Python module MySQLdb is installed properly on your ... Read More
![Mohd Mohtashim](https://www.tutorialspoint.com/assets/profiles/152429/profile/60_230655-1575021953.jpg)
Mohd Mohtashim
2K+ Views
Before proceeding, you make sure you have MySQLdb installed on your machine. Just type the following in your Python script and execute it −#!/usr/bin/python import MySQLdbIf it produces the following result, then it means MySQLdb module is not installed −Traceback (most recent call last): File "test.py", line 3, in ... Read More
![Mohd Mohtashim](https://www.tutorialspoint.com/assets/profiles/152429/profile/60_230655-1575021953.jpg)
Mohd Mohtashim
330 Views
Sometimes, it is desired that you want to give option where a user can click a link and it will pop up a "File Download" dialogue box to the user instead of displaying actual content. This is very easy and can be achieved through HTTP header. This HTTP header is ... Read More
![Mohd Mohtashim](https://www.tutorialspoint.com/assets/profiles/152429/profile/60_230655-1575021953.jpg)
Mohd Mohtashim
8K+ Views
To upload a file, the HTML form must have the enctype attribute set to multipart/form-data. The input tag with the file type creates a "Browse" button. File: OutputThe result of this code is the following form −Above example has been disabled ... Read More
![Mohd Mohtashim](https://www.tutorialspoint.com/assets/profiles/152429/profile/60_230655-1575021953.jpg)
Mohd Mohtashim
2K+ Views
It is very easy to send cookies to browser. These cookies are sent along with HTTP Header before to Content-type field. Assuming you want to set UserID and Password as cookies. Setting the cookies is done as follows −Example#!/usr/bin/python print "Set-Cookie:UserID = XYZ;\r" print "Set-Cookie:Password = XYZ123;\r" print "Set-Cookie:Expires = ... Read More