Program 1: Create Employee Table
Write a program to create an Employee table and insert records.
import sqlite3
print("\nProgram 1: Create Employee Table\n")
conn = [Link](":memory:")
cursor = [Link]()
[Link]("CREATE TABLE Employee (EmpID INTEGER PRIMARY KEY, Name TEXT, Salary INTEGER)")
[Link]("INSERT INTO Employee VALUES (?, ?, ?)", [
(1, "Amit", 50000),
(2, "Neha", 60000),
(3, "Rajesh", 55000)
])
[Link]("SELECT * FROM Employee")
for row in [Link]():
print(row)
[Link]()
Program 2: Select Employees with Salary > 55000
Write a program to select employees whose salary is greater than 55000.
import sqlite3
print("\nProgram 2: Select Employees with Salary > 55000\n")
conn = [Link](":memory:")
cursor = [Link]()
[Link]("CREATE TABLE Employee (EmpID INTEGER PRIMARY KEY, Name TEXT, Salary INTEGER)")
[Link]("INSERT INTO Employee VALUES (?, ?, ?)", [
(1, "Amit", 50000),
(2, "Neha", 60000),
(3, "Rajesh", 55000)
])
[Link]("SELECT * FROM Employee WHERE Salary > 55000")
for row in [Link]():
print(row)
[Link]()