-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathand_or.py
More file actions
41 lines (24 loc) · 763 Bytes
/
and_or.py
File metadata and controls
41 lines (24 loc) · 763 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
30
31
32
33
34
35
36
37
38
39
40
41
# Clearing the screen
import os
os.system('clear')
# Importing sqlite3 module
import sqlite3
# Establishing a connection and create DB
conn = sqlite3.connect('customer.db')
# Creating a cursor
c = conn.cursor()
# Query using AND OR
c.execute("SELECT rowid, * FROM customers WHERE email LIKE '%@email' AND first_name LIKE 'Ja%' ")
items = c.fetchall()
for item in items:
print(item)
print("***************************************************************************************************************")
# Query using AND OR
c.execute("SELECT rowid, * FROM customers WHERE email LIKE '%@email' OR first_name LIKE 'Ja%' ")
query = c.fetchall()
for i in query:
print(i)
# Commiting changes made
conn.commit()
# Closing our connection
conn.close()