sqlite3.SQLITE_CREATE_TABLE


Definition
The method create the table in the Database.

Syntax
sqlite3.SQLITE_CREATE_TABLE

Examples
The database contact_form is created using Sqlite3. 
>>> import sqlite3
conn=sqlite3.connect('contact_form.db')
cursor=conn.cursor()
>>> cursor.execute('''CREATE TABLE table1(name text, phone text, email text, income text)''')
<sqlite3.Cursor object at 0x0000000004329810>
>>> cursor.execute("INSERT INTO table1 VALUES('ADIL', '571 247 8186', adil@pythonlake.com', '150,000')")
>>> cursor.execute("INSERT INTO table1 VALUES('ADIL', '571 247 8186', 'adil@pythonlake.com', 1'50,000')")
<sqlite3.Cursor object at 0x0000000004329810>
>>> conn.commit()
>>>for row in cursor.execute('SELECT * FROM table1 ORDER BY name'):
print(row)
('ADIL', '571 247 8186', 'adil@pythonlake.com', '150,000')

>>>in cursor.execute('SELECT * FROM table1 ORDER BY name'):
print(row+row)

('ADIL', '571 247 8186', 'adil@pythonlake.com', '150,000', 'ADIL', '571 247 8186', 'adil@pythonlake.com', '150,000')

>>>for row in cursor.execute('SELECT * FROM table1 ORDER BY name'):
row.count("Adil")
0
>>> for row in cursor.execute('SELECT * FROM table1 ORDER BY name'):
len(row)
4


sqlite3


Comments