དཔལ་ལྡན་འབྲུག་གཞུང་། ཤེས་རིག་དང་རིག་རྩལ་གོང་འཕེལ་ལྷན་ཁག།
Department of School Education
Ministry of Education & Skills Development
Online Training for ICT Teachers
17 February 2023
Classes XI & XII ICT Curriculum
SQLite SESSION I
SESSION I
Session Outline
ICT Curriculum
Introduction to Database
Comparing Spreadsheet and Database
Creating Database using SQLite
Stock Register Database
1
Student Details Database
SQLite
2
3
4
5
6
ICT Curriculum
Competency
Objectives
Use a database management system in an application for easy access, and secure data storage and management.
Develop a CRUD application using Tkinter as frontend, Python as backend and SQLite for the database
Insert, delete, update, and Select data from the SQLite database using SQL.
Develop a database application using the SQLite module.
Create a SQLite database.
Explain the functions of the database system.
Content Scope
Database Management System
Database Application
Definition of Database
Importance of Database
Terminology in Database
CRUD Operations
Database
Tuples
Attributes
Tables
Create
Read
Update
Delete
Create table
Read Record
Update Record
Delete Record
Drop Table
Select Record
Insert Record
Import sqlite3 library
connect()
execute()
commit()
Close()
SQLite Browser
SQLite Database
SQLite Query
Connect to Database
SQLite Database with Tkinter
Career Opportunities
Data Administrator
Data Analyst
Business Intelligence Analyst
Database Developer
Data Scientist
Software Developer
Cloud Database Engineer
Introduction to Database
A database is an organized collection of data, which is stored on a computer system.
1
It is used to store, manage, and manipulate data in a structured format.
2
They are an essential part of any organization’s IT infrastructure.
3
Uses SQL(Structured Query Language) for managing and manipulating databases.
4
Examples of Database Management System (DBMS): MySQL, MongoDB, SQLite, MS-Access, Oracle
5
Database
Features
Data Reliability
1
Data Security
2
Data Integrity
3
Data Manipulation
4
Collaboration among users
5
Data Redundancy
6
SQLite
It is an embedded SQL database engine and it is not a standalone application, but rather a library that software developers embed in their applications.
3
It is a self-contained, serverless, zero-configuration, and transactional SQL database engine.
2
Software library that provides a database management system.
1
Comparing Spreadsheet and Database
Database and Spreadsheet
Spreadsheet
SQLite
Discuss how are these two similar?
Store large amounts of data
1
Search and retrieve specific data
2
Sort and filter data
3
Perform calculations and analysis on data
4
Use tables to organize data.
5
Similarities
Differences
Database
Spreadsheet
Creating Database using SQLite
First database in SQLite
Output
Sample Code
Variable_name = sqlite3.connect(‘DatabaseFileName.db’)
Import the sqlite3 module
Stock Register Database
Stock Register Database
Write a python program to create a table named Stocks in the StockRegister.db with the following fields:
Add 4 records in the table Stocks and view all the records from the table.
Sample Code
Output
Stock Register Database
Write a python program to create a table named Stocks in the StockRegister.db with the following fields:
Sample Code
Output
Stock Register Database
Write a python program that connects to the StockRegister.db and add 4 records in the table Stocks(Add few duplicate data).
Sample Code
Output
Stock Register Database
Write a python program that connects to the StockRegister.db database and to view all the records in the Stocks table.
Sample Code
Output
Stock Register Database
Write a python program and connect to StockRegister.db.
Retrieve and view the records where StockNo=102
Sample Code
Output
A primary key is a special type of column in a table that is used to uniquely identify each row in the table.
1
Special identifier for each record in the table.
2
Think of a primary key as a special type of ID number, like a CID No or a passport number.
3
Primary keys are used to maintain the integrity of the data in a table, by ensuring that each row has a unique identifier.
4
Primary key values must be unique and can't be null.
5
Primary Key
Identify the Primary Key
CustID | Name | Bill Amount | Remarks |
001 | Sonam | 12000 | Paid |
002 | Tshering | 23000 | Not paid |
003 | Sonam | 23000 | Not Paid |
Student Details Database
Student Details Database
Write a python program to create a new database StudentDetails.db and create a table named Details with the following fields:
Set StdCode as the Primary Key.
Add four records and the view the records
Sample Code
Output
Student Details Database
Write a python program to connect to the database StudentDetails.db
Sample Code
Output
Student Details Database
Write a python program to connect to the database StudentDetails.db
Sample Code
Output
Post Session Activity
Complete the tasks Activity I and Activity II under SQLite topic in the Google Classroom.