Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

I have to create a database using python to show geographical points.

  1. Create a program the will create your database and insert at least five points. Use your own data, something like:

100, 200, 123, Main Campus

120, 133, 142, Montoya

153, 123, 322, Rio Rancho

133, 123, 143, STEMULUS Center

153, 142, 122, ATC

 

  1. Run your initialization code to create the database.
IDLE File Edit Format Run Options
D2L Python-Ch13...
<
Central New...
Table of Contents > Module 9 > Pyt
Python-Ch13
Update
O
Window Help
Fil
*YazzieTP9.py - /Users/tishenayazzie/Documents/YazzieTP9.py
import sqlite3
conn = sqlite3.connect( 'demoDB]. db')
curs
conn.cursor()
sqlCmd = 'SELECT ROWID, * FROM tblDemo'
curs.execute(sqlCmd)
Num1Field INT,
Num2Field FLOAT,
String Field TEXT
)
Q↑↓ 25 of 27')
data = curs.fetchall()
curs.execute('''
CREATE TABLE tblDemo (
startingData = (
(100, 200, 123, 'Main Campus'),
(120,133,142, 'Montoya'),
(153, 123,322, 'Rio Rancho'),
(133, 123, 143, 'STEMULUS Center'),
(153, 142, 122, 'ATC')
)
for row in startingData:
sqlCmd=
INSERT INTO tblDemo (Num1Field, Num2 Field, String Field)
VALUES (?, ?, ?)
III
curs.execute(sqlCmd, row)
conn.commit()
conn.close()
print (data)
10
11
12
13
14
15 for x in myresults:
16
print (x)
17
18 conn.commit()
19 conn.close()
20
mycourses.cnm.edu
NOV 1
22
اله
TXT
(3.7.9)*
Ln: 2
Python 3.7.9 Shell
Python 3.7.9 (v3.7.9:13c94747c7, Aug 15 2020, 01:31:08)
(clang-600.0.57)] on darwin
[C
tv ♫
Col: 30
2
"copyright", "credits" or "license()" for more information.
RESTART: /Users/tishenayazzie/Documents/YazzieTP9.py
=== RESTART: /Users/tishenayazzie/Documents/YazzieTP9.py
most recent call last):
sers/tishenayazzie/Documents/Yazzie TP9.py", line 11, in <module>
rationalError: table tblDemo already exists
=== RESTART: /Users/tishenayazzie/Documents/YazzieTP9.py
most recent call last):
sers/tishenayazzie/Documents/YazzieTP9.py", line 13, in <module>
rationalError: table tblDemo already exists
A
W
Tue Nov 22 6:48 PM
DOCX
Ln: 18
Col: 4
TE
Points
expand button
Transcribed Image Text:IDLE File Edit Format Run Options D2L Python-Ch13... < Central New... Table of Contents > Module 9 > Pyt Python-Ch13 Update O Window Help Fil *YazzieTP9.py - /Users/tishenayazzie/Documents/YazzieTP9.py import sqlite3 conn = sqlite3.connect( 'demoDB]. db') curs conn.cursor() sqlCmd = 'SELECT ROWID, * FROM tblDemo' curs.execute(sqlCmd) Num1Field INT, Num2Field FLOAT, String Field TEXT ) Q↑↓ 25 of 27') data = curs.fetchall() curs.execute(''' CREATE TABLE tblDemo ( startingData = ( (100, 200, 123, 'Main Campus'), (120,133,142, 'Montoya'), (153, 123,322, 'Rio Rancho'), (133, 123, 143, 'STEMULUS Center'), (153, 142, 122, 'ATC') ) for row in startingData: sqlCmd= INSERT INTO tblDemo (Num1Field, Num2 Field, String Field) VALUES (?, ?, ?) III curs.execute(sqlCmd, row) conn.commit() conn.close() print (data) 10 11 12 13 14 15 for x in myresults: 16 print (x) 17 18 conn.commit() 19 conn.close() 20 mycourses.cnm.edu NOV 1 22 اله TXT (3.7.9)* Ln: 2 Python 3.7.9 Shell Python 3.7.9 (v3.7.9:13c94747c7, Aug 15 2020, 01:31:08) (clang-600.0.57)] on darwin [C tv ♫ Col: 30 2 "copyright", "credits" or "license()" for more information. RESTART: /Users/tishenayazzie/Documents/YazzieTP9.py === RESTART: /Users/tishenayazzie/Documents/YazzieTP9.py most recent call last): sers/tishenayazzie/Documents/Yazzie TP9.py", line 11, in <module> rationalError: table tblDemo already exists === RESTART: /Users/tishenayazzie/Documents/YazzieTP9.py most recent call last): sers/tishenayazzie/Documents/YazzieTP9.py", line 13, in <module> rationalError: table tblDemo already exists A W Tue Nov 22 6:48 PM DOCX Ln: 18 Col: 4 TE Points
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education