
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
I have to create a
- 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
- 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](https://content.bartleby.com/qna-images/question/75caf353-1d6b-4c64-a099-344a34c0daad/d9d3d377-fbe2-4c05-8cb3-235b1751bc74/nbau0q_thumbnail.png)
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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
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
- Look at the code below and use the following comments to incdicate the scope of the static variables or functions. Place the comment below the relevant line. Module scope Class scope Function scope The code runs. Use onlinegdb.com to see it run. Module scope means global but only known in this source file. Class scope means global but only known by the class. Function scope means global but only known in the function. Hide Comments 1 #include 2 static const int MAX_SIZE=10; 5 // Return the max value 6 static double max(double d1) 7 { static double lastMax = 0; lastMax = (di > lastMax) ? di : lastMax; return lastMax; 8 10 11 } 12 13 // singleton class only one instance allowed 14 class singleton 15 { public: static Singleton& getsingleton() { return theone; } // Returns the Singleton 16 17 18 19 20 friend std::ostream& operator<< (std::ostream& o, const Singleton& s); private: Singleton() { }; // Prevents more instances 21 22 23 24 25 static Singleton theone; 26 }; 27 Singleton…arrow_forwardcalculate_trip_time( iata_src: str, iata_dst: str, flight_walk: List[str], flights: Flight Dir float: def ) -> """ Return a float corresponding to the amount of time required to travel from the source airport to the destination airport to the destination airport, as outlined by the flight_walk. The start time of the trip should be considered zero. In other words, assuming we start the trip at 12:00am, this function should return the time it takes for the trip to finish, including all the waiting times before, and between the flights. If there is no path available, return -1.0 >>> calculate_trip_time("AA1", "AA2", ["AA1", "AA2"], TEST_FLIGHTS_DIR_FOUR_ 2.0 "AA7", ["AA7", "AA1"], TEST_FLIGHTS_DIR_FOUR_ "AA7", ["AA1", "AA7"], TEST_FLIGHTS_DIR_FOUR_ "AA1", ["AA1"], TEST_FLIGHTS_DIR_FOUR_CITIES) "AA2", ["AA4", "AA1", "AA2"], TEST_FLIGHTS_DI "AA3", ["AA1", "AA2", "AA3"], TEST_FLIGHTS_DI >>> calculate_trip_time("AA1", "AA4", ["AA1", "AA4"], TEST_FLIGHTS_DIR_FOUR_ 2.0 || || || >>>…arrow_forwardhow to insert the following: Insert Into Director Values(1,'Josh','Klemm',1) Insert Into Director Values(2,'Jeff','Bezos',10) Insert Into Director Values(1,'Elon','Musk',50) Insert Into Director Values(3,'Elon','Musk',500000) Insert Into Director Values(3,'Elon','Musk',5)arrow_forward
- Complete the Python program to create a Horse table, insert one row, and display the row. The main program calls four functions: create_connection() creates a connection to the database. create_table() creates the Horse table. insert_horse() inserts one row into Horse. select_all_horses() outputs all Horse rows. Complete all four functions. Function parameters are described in the template. Do not modify the main program. The Horse table should have five columns, with the following names, data types, constraints, and values: Name Data type Constraints Value Id integer primary key, not null 1 Name text 'Babe' Breed text 'Quarter horse' Height double 15.3 BirthDate text '2015-02-10' The program output should be: All horses: (1, 'Babe', 'Quarter Horse', 15.3, '2015-02-10')arrow_forwardUsing the data file below design a hierarchical struct to organize the data. Then declare an array of structs for the reservations. The data file contains ten reservations. There are 8 columns of data: party name, size, date and time for the reservation, phone number, email address, credit card number and expiration date for the credit card. The data can be read from the file below so you will not need to type it in repeatedly. Once you have populated the array with data perform the following tasks: Write a function that will print out to the screen the information for one reservation.In the main program write code that prompts the user to enter a date in the form MM DD YYYYCall the function to print out all reservations on that date. You can make a loop that calls the print function repeatedly or you can put that code inside the print function.TEST CASES: April 30, 2023 and May 12, 2023. In this example you need to carefully consider what data types to use. For example, the credit…arrow_forwardThe file london_weather.csv contains weather data for the years 1979 to 2020. The first five lines of this file are: date,cloud_cover,sunshine,global_radiation,max_temp,mean_temp,min_temp,precipitation,pressure,snow_depth19790101,2,7,52,2.3,-4.1,-7.5,0.4,101900,919790102,6,1.7,27,1.6,-2.6,-7.5,0,102530,819790103,5,0,13,1.3,-2.8,-7.2,0,102050,419790104,8,0,13,-0.3,-2.6,-6.5,0,100840,2 Note, in particular, that the dates are given as eight-digit integers in the format YYYYMMDD. There appears to be some inconsistencies in this data, as there are rows for which the column max_temp contains an entry that is smaller than the corresponding entry in min_temp. Write a Python function wrong_temperature(year) that returns the number of days in a given year for which the column max_temp contains an entry that is smaller than the corresponding entry in the column min_temp.arrow_forward
- Using the data file below design a hierarchical struct to organize the data. Then declare an array of structs for the reservations. The data file contains ten reservations. There are 8 columns of data: party name, size, date and time for the reservation, phone number, email address, credit card number and expiration date for the credit card. The data can be read from the file below so you will not need to type it in repeatedly. Once you have populated the array with data perform the following tasks: Write a function that will print out to the screen the information for one reservation.In the main program write code that prompts the user to enter a date in the form MM DD YYYYCall the function to print out all reservations on that date. You can make a loop that calls the print function repeatedly or you can put that code inside the print function.TEST CASES: April 30, 2023 and May 12, 2023. In this example you need to carefully consider what data types to use. For example, the credit…arrow_forwardHive table’s column, PERSON has an array value, [“jihee”, “jong”,“hemo”]. What function generate three records from the array value,[“jihee”, “jong”, “hemo”]?a. RECORDS(PERSON)b. EXPLODE(PERSON)c. LINES(PERSON)d. ROWS(PERSON)arrow_forwardFor this week's assignment you will allow the user to add employee, view all employees, search employee by ssn, and edit employee information. Below this is what its supposed to look like when completed. I have also included what I started to do but I can't figure out how to add the search by SSN option or the edit employee option. If you can give me a step by step on how to do this in python I would greatly appreciate it.arrow_forward
- When the Search button is pressed in the screen depicted, the getSales() function from the PosDAO.java class is called, the parameters of this function are the from date and to date.The getSales () function should return a list of Pos objects that matches the criteria specified, Note this function has to perform two INNER JOINs in to combine all three tables in order to get all the needed data to fill the Pos object. The database schema is also depicted. The PosDAO, Product, SalesDetails and Pos classes are shown BELOW Write the getSales() function public class PosDAO { private Connection conn; PreparedStatement stmt = null; public boolean openConnection(){ try { // db parameters String url = "jdbc:mysql://localhost:4306/swen2005"; String user = "root"; String password = ""; // create a connection to the database conn = DriverManager.getConnection(url, user, password); if (conn!= null){ return true;…arrow_forwardThe symbol table stores the memory address associated with each variable. What is the memory address of the start_time variable in main()? You only need to fill in the last 2 digits of the address. 0x7ffd949d30__ What symbol was added after the data type of MoveSchedule's start_time and end_time parameters? Place a check (✓) beside your answer. int * & start_time What is the memory address of the start_time variable in MoveSchedule()? You only need to fill in the last 2 digits of the address. 0x7ffd949d30__ What happens to the value of the start_time variable in main() when the start_time variable in MoveSchedule is updated? Place a check (✓) beside your answer. start_time in main remains the same start_time in main gets the value assigned to start_time in MoveSchedule start_time in main changes to 0.arrow_forwardYou have a table that contains the following fields: Last Name, First Name, Street, City, State, and Postal Code. There are 50,000 records in the table. What indexes would you create for the table? You have a table that contains the following fields: Book ISBN Number, Book Title, Author Last Name, Author First Name, Publication Year, and Publisher Name. There are 75,000 records in the table. What indexes would you create for the table?arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education