📖 generic · 12th TN - English Medium · COMPUTER SCIENCE · Page 284question

DATA MANIPULATION THROUGH SQL · Part 13

Chapter 4: 6 · COMPUTER SCIENCE

import sqlite3 con = sqlite3.connect('Academy.db') cursor = con.cursor() cursor.execute("SELECT name FROM WHERE type='table';") print(cursor.fetchall()) OUTPUT [('Student',), ('Appointment',), ('Person',)] 12th Computer Chapter - - The above program (Example . - ) 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 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. • A database is an organized collection of data.

• Users of database can be human users, other programs or applications • SQLite is a simple relational database system, which saves its data in regular data files. • Cursor is a control structure used to traverse and fetch the records of the database. All the SQL commands will be executed using cursor object only. • As data in a table might contain single or double quotes, SQL commands in Python are denoted as triple quoted string.

• “Select” is the most commonly used statement in SQL • The SELECT Statement in SQL is used to retrieve or fetch data from a table in a database • The GROUP BY clause groups records into summary rows • The ORDER BY Clause can be used along with the SELECT statement to sort the data of specific fields in an ordered way • Having clause is used to filter data based on the group functions. • Where clause cannot be used along with ‘Group by’ • The WHERE clause can be combined with AND, OR, and NOT operators • The ‘AND’ and ‘OR’ operators are used to filter records based on more than one condition • Aggregate functions are used to do operations from the values of the column and a single value is returned. • COUNT() function returns the number of rows in a table. • AVG() function retrieves the average of a selected column

Related topics

Have a question about this topic?

Get an AI answer grounded in your actual textbook — with the exact page reference.

Ask AI about this topic →