0% found this document useful (0 votes)
4 views2 pages

Python MySQL Practice Questions-1

The document outlines several MySQL databases (SchoolDB, LibraryDB, HospitalDB, CollegeDB, and ClinicDB) and their respective tables with specific attributes. It provides Python program instructions for inserting a record into the Employees table, updating the status of a book in the BDUBooks table, deleting a doctor record from the Doctors table, displaying student details based on marks, and creating a Patients table in the ClinicDB database. Each database connection requires specific credentials for access.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Python MySQL Practice Questions-1

The document outlines several MySQL databases (SchoolDB, LibraryDB, HospitalDB, CollegeDB, and ClinicDB) and their respective tables with specific attributes. It provides Python program instructions for inserting a record into the Employees table, updating the status of a book in the BDUBooks table, deleting a doctor record from the Doctors table, displaying student details based on marks, and creating a Patients table in the ClinicDB database. Each database connection requires specific credentials for access.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

A MySQL database named SchoolDB has an Employees table in MySQL which contains the

following attributes:
Emp_ID : Employee ID (Integer)
Emp_Name : Employee Name (String)
Department : Department (String)
Salary : Salary (Float)

Consider the following details to establish Python-MySQL connectivity:


Username: admin
Password: admin123
Host: localhost

Write a Python program to insert the following record into the Employees table:
(101, 'Ravi', 'HR', 35000).

A MySQL database named LibraryDB has a BDUBooks table in MySQL which contains the
following attributes:
B_Code : Book code (Integer)
Book_Name : Name of the book (String)
Author : Author of the book (String)
Status : Issued/Available (String)

Consider the following details to establish Python-MySQL connectivity:


Username: root
Password: mysql123
Host: localhost

Write a Python program to change the Status of the book to 'Issued' whose B_Code is 524 in the
BDUBooks table.

A MySQL database named HospitalDB has a Doctors table in MySQL which contains the following
attributes:
D_ID : Doctor ID (Integer)
Doctor_Name : Doctor Name (String)
Specialization : Specialization (String)

Consider the following details to establish Python-MySQL connectivity:


Username: hospital
Password: hosp123
Host: localhost

Write a Python program to delete the record whose D_ID is 205 from the Doctors table.

A MySQL database named CollegeDB has a Students table in MySQL which contains the following
attributes:
Roll_No : Roll Number (Integer)
Student_Name : Student Name (String)
Class : Class (String)
Marks : Marks (Integer)

Consider the following details to establish Python-MySQL connectivity:


Username: student
Password: stud123
Host: localhost
Write a Python program to display the details of all students whose Marks are greater than 450 from
the Students table.

A MySQL database named ClinicDB has a Patients table in MySQL which contains the following
attributes:
P_ID : Patient ID (Integer)
Patient_Name : Patient Name (String)
Disease : Disease (String)

Consider the following details to establish Python-MySQL connectivity:


Username: clinic
Password: clinic123
Host: localhost

Write a Python program to create the Patients table with the above structure in the ClinicDB
database.

You might also like