Data Manipulation Through SQL - Table List | 12th Computer Science : Chapter 15 : Integrating Python with MySql and C++ : Data Manipulation Through SQL

Chapter: 12th Computer Science : Chapter 15 : Integrating Python with MySql and C++ : Data Manipulation Through SQL

Table List

To show (display) the list of tables created in a database the following program can be used.

Table List

To show (display) the list of tables created in a database the following program can be used.

 

Example

import sqlite3

con = sqlite3.connect('Academy.db')

cursor = con.cursor()

cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")

print(cursor.fetchall())

OUTPUT

[('Student',), ('Appointment',), ('Person',)]

 

The above program (Example 15.3-1) display the names of all tables created in ‘Academy. db’ database. The master table holds the key information about your database tables and it is called sqlite_master

So far, you have been using the Structured Query Language in Python scripts. This chapter has covered many of the basic SQL commands. Almost all sql commands can be executed by Python SQLite module. You can even try the other commands discussed in the SQL chapter.


Tags : Data Manipulation Through SQL , 12th Computer Science : Chapter 15 : Integrating Python with MySql and C++ : Data Manipulation Through SQL
Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
12th Computer Science : Chapter 15 : Integrating Python with MySql and C++ : Data Manipulation Through SQL : Table List | Data Manipulation Through SQL


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.