To retrieve data from a database we have to make use of the module available for that database. For MySQL database, we import MySQLdb module in our Python script.
We have to first connect to a specific database by passing URL, username, password and the name of database.
Once we establish the connection, we can open a cursor with cursor() function. On an open cursor, we can run fetch() function to execute queries and retrieve data from the database tables.
High Quality MCQsExam-focused questions with accurate answersDetailed ExplanationsStep-by-step explanations to enhance learningLatest Exam PatternBased on updated syllabus and patternPerformance AnalyticsTrack performance and improve weak areas100% Free PracticePractice unlimited questions for free