हिंदी

Read the following details Based on that write a python script to display department-wise records database name:- organization.db Table name:- Employee Columns in the table:- Eno, EmpName, Esal, Dept

Advertisements

प्रश्न

Read the following details Based on that write a python script to display department-wise records

database name:- organization.db

Table name:- Employee

Columns in the table:- Eno, EmpName, Esal, Dept

संक्षेप में उत्तर
Advertisements

उत्तर

Contents of Table: Employee

Eno EmpName Esal Dept
1001 Aswin 28000 IT
1003 Helena 32000 Accounts
1005 Hycinth 41000 IT

Coding:

import sqlite3
connection = sqlite3. connect
(” organization, db”)
cursor = connection, cursor ()
sqlcmd=””” SELECT *FROM
Employee ORDER BY Dept”””
cursor, execute (sqlcmd)
result = cursor, fetchall ()
print (“Department wise Employee List”)
for i in result:
print(i)
connection. close()

Output:

Department wise Employee List
(1003,’Helena’,32000, ‘Accounts’)
(1001,’Aswin’,28000,’IT’)
(1005,’Hycinth’,41000,’IT’)

shaalaa.com
Updating a Record
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 15: Data manipulation through SQL - Evaluation [पृष्ठ ३१८]
Advertisements
Share
Notifications



      Forgot password?
Use app×