-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPyDB_SQLite_1.py
More file actions
29 lines (21 loc) · 863 Bytes
/
PyDB_SQLite_1.py
File metadata and controls
29 lines (21 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#Program 1
import sqlite3 # Database Module
# Connection #Databse location
connection = sqlite3.connect("C:/Users/vasud/Desktop/Workstation/Py_Program/Database/Academy.db")
cursor = connection.cursor()
cursor.execute("DROP Table Students")
#SQL Querry
sql_command = ''' CREATE TABLE Students(
RollNo INTEGER PRIMARY KEY,
Name VARCHAR(20),
Grade CHAR(1),
Gender CHAR(1),
Average DECIMAL(5,2),
Birth_Date DATE ); '''
cursor.execute(sql_command) #Querry Execution
sql_command1 = '''INSERT INTO
Students(RollNo,Name,Grade,Gender,Average,Birth_Date)
Values(null,"Vasudevan",'A',"Male","95.5","03-01-2002")
;'''
cursor.execute(sql_command1)
connection.commit() # Save The DB