0% found this document useful (0 votes)
159 views1 page

Our First Database

The document provides instructions for completing an assignment involving SQLite databases in Python. Students are instructed to: 1. Create a table called "Ages" with name and age columns in a SQLite database. 2. Insert specific name and age values into the Ages table. 3. Run a SELECT query on the Ages table to concatenate and hex encode the name and age values. 4. Submit the hex value from the first result row, which starts with "416".

Uploaded by

mgm9211
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
159 views1 page

Our First Database

The document provides instructions for completing an assignment involving SQLite databases in Python. Students are instructed to: 1. Create a table called "Ages" with name and age columns in a SQLite database. 2. Insert specific name and age values into the Ages table. 3. Run a SELECT query on the Ages table to concatenate and hex encode the name and age values. 4. Submit the hex value from the first result row, which starts with "416".

Uploaded by

mgm9211
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

17/10/2020 PY4E - Python for Everybody

Hecho

Bienvenido María Moreno de Using Databases with Python

To get credit for this assignment, perform the instructions below and enter the code you get here:

Enviar

(Hint: starts with 416)

Instructions
If you don't already have it, install the SQLite Browser from http://sqlitebrowser.org/ .

Then, create a SQLITE database or use an existing database and create a table in the database called "Ages":

CREATE TABLE Ages (


name VARCHAR(128),
age INTEGER
)

Then make sure the table is empty by deleting any rows that you previously inserted, and insert these rows and
only these rows with the following commands:

DELETE FROM Ages;


INSERT INTO Ages (name, age) VALUES ('Morwena', 39);
INSERT INTO Ages (name, age) VALUES ('Aishah', 23);
INSERT INTO Ages (name, age) VALUES ('Shivani', 33);
INSERT INTO Ages (name, age) VALUES ('Evelynne', 37);
INSERT INTO Ages (name, age) VALUES ('Ilyas', 30);
INSERT INTO Ages (name, age) VALUES ('Jodi', 37);

Once the inserts are done, run the following SQL command:

SELECT hex(name || age) AS X FROM Ages ORDER BY X

Find the first row in the resulting record set and enter the long string that looks like 53656C696E613333.

Note: This assignment must be done using SQLite - in particular, the SELECT query above will not work in any
other database. So you cannot use MySQL or Oracle for this assignment.

Seleccionar idioma ▼

https://www.py4e.com/tools/sql-intro/?PHPSESSID=1cb78f1ab8a9e802a239f0f2a215f3e3 1/1

You might also like