Docker Setup

I have setup the docker container to run the model evaluation.

Initial Query

I have a sqlite3 database name TEXT, favorite_friend TEXT, age INT, profession TEXT. Write me a python program that prints out the favorite friend of the youngest person who isn't anyone's favorite friend. The database is called people.db and the table is called people.

LLM Generation

Query

I have a sqlite3 database name TEXT, favorite_friend TEXT, age INT, profession TEXT. Write me a python program that prints out the favorite friend of the youngest person who isn't anyone's favorite friend. The database is called people.db and the table is called people.

Output

Here's a Python script using sqlite3 to solve this problem:

 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
42
43
44
import sqlite3

def find_youngest_unfavorite_friend():
    # Connect to the database
    conn = sqlite3.connect('people.db')
    cursor = conn.cursor()

    # Find the youngest person who isn't anyone's favorite friend
    query = '''
    SELECT name, favorite_friend, age
    FROM people p1
    WHERE age = (
        SELECT MIN(age) 
        FROM people p2 
        WHERE p2.name NOT IN (
            SELECT favorite_friend 
            FROM people 
            WHERE favorite_friend IS NOT NULL
        )
    )
    AND p1.name NOT IN (
        SELECT favorite_friend 
        FROM people 
        WHERE favorite_friend IS NOT NULL
    )
    '''

    cursor.execute(query)
    result = cursor.fetchone()

    # Close the connection
    conn.close()

    # Print the result
    if result:
        name, favorite_friend, age = result
        print(f"Youngest unfavorite friend: {name}")
        print(f"Their favorite friend: {favorite_friend}")
        print(f"Age: {age}")
    else:
        print("No such person found")

# Run the function
find_youngest_unfavorite_friend()
This script does the following: 1. Connects to the 'people.db' database 2. Creates a complex SQL query that: - Finds the minimum age of people who are not anyone's favorite friend - Selects the person with that age who is also not a favorite friend of anyone 3. Executes the query and fetches the first result 4. Prints out the name, favorite friend, and age of the youngest person who isn't anyone's favorite friend The query uses subqueries to: - Find people who are not anyone's favorite friend - Find the minimum age among those people - Select the specific person matching those criteria Make sure to replace 'people.db' with the actual path to your database if it's not in the same directory as the script.

Extract Code

I extracted the following code from that output:

 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
42
43
44
import sqlite3

def find_youngest_unfavorite_friend():
    # Connect to the database
    conn = sqlite3.connect('people.db')
    cursor = conn.cursor()

    # Find the youngest person who isn't anyone's favorite friend
    query = '''
    SELECT name, favorite_friend, age
    FROM people p1
    WHERE age = (
        SELECT MIN(age) 
        FROM people p2 
        WHERE p2.name NOT IN (
            SELECT favorite_friend 
            FROM people 
            WHERE favorite_friend IS NOT NULL
        )
    )
    AND p1.name NOT IN (
        SELECT favorite_friend 
        FROM people 
        WHERE favorite_friend IS NOT NULL
    )
    '''

    cursor.execute(query)
    result = cursor.fetchone()

    # Close the connection
    conn.close()

    # Print the result
    if result:
        name, favorite_friend, age = result
        print(f"Youngest unfavorite friend: {name}")
        print(f"Their favorite friend: {favorite_friend}")
        print(f"Age: {age}")
    else:
        print("No such person found")

# Run the function
find_youngest_unfavorite_friend()

Run Code Interpreter

Running the following program:

 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
42
43
44
import sqlite3

def find_youngest_unfavorite_friend():
    # Connect to the database
    conn = sqlite3.connect('people.db')
    cursor = conn.cursor()

    # Find the youngest person who isn't anyone's favorite friend
    query = '''
    SELECT name, favorite_friend, age
    FROM people p1
    WHERE age = (
        SELECT MIN(age) 
        FROM people p2 
        WHERE p2.name NOT IN (
            SELECT favorite_friend 
            FROM people 
            WHERE favorite_friend IS NOT NULL
        )
    )
    AND p1.name NOT IN (
        SELECT favorite_friend 
        FROM people 
        WHERE favorite_friend IS NOT NULL
    )
    '''

    cursor.execute(query)
    result = cursor.fetchone()

    # Close the connection
    conn.close()

    # Print the result
    if result:
        name, favorite_friend, age = result
        print(f"Youngest unfavorite friend: {name}")
        print(f"Their favorite friend: {favorite_friend}")
        print(f"Age: {age}")
    else:
        print("No such person found")

# Run the function
find_youngest_unfavorite_friend()
And got the output: Youngest unfavorite friend: Judy Their favorite friend: Grace Age: 27

Substring Evaluation

Testing if the previous output contains the string Grace: True

Docker Setup

I have setup the docker container to run the model evaluation.

Initial Query

I have a sqlite3 database name TEXT, favorite_friend TEXT, age INT, profession TEXT. Write me a python program that prints out the favorite friend of the youngest person who isn't anyone's favorite friend. The database is called people.db and the table is called people.

LLM Generation

Query

I have a sqlite3 database name TEXT, favorite_friend TEXT, age INT, profession TEXT. Write me a python program that prints out the favorite friend of the youngest person who isn't anyone's favorite friend. The database is called people.db and the table is called people.

Output

Here's a Python script using SQLite3 that accomplishes this task:

 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
import sqlite3

# Connect to the database
conn = sqlite3.connect('people.db')
cursor = conn.cursor()

# Query to find the youngest person who isn't anyone's favorite friend
query = '''
SELECT name, favorite_friend, age 
FROM people 
WHERE name NOT IN (
    SELECT favorite_friend 
    FROM people 
    WHERE favorite_friend IS NOT NULL
) 
ORDER BY age ASC 
LIMIT 1
'''

# Execute the query
cursor.execute(query)

# Fetch the result
result = cursor.fetchone()

# Check if a result was found
if result:
    name, favorite_friend, age = result
    print(f"The youngest person not being anyone's favorite friend is {name}")
    print(f"Their favorite friend is: {favorite_friend}")
    print(f"Their age is: {age}")
else:
    print("No such person found")

# Close the database connection
conn.close()
This script does the following: 1. It connects to the 'people.db' database. 2. The SQL query does several things: - `WHERE name NOT IN (...)` finds people who are not anyone's favorite friend - `ORDER BY age ASC` sorts by age in ascending order - `LIMIT 1` selects only the first (youngest) person 3. It executes the query and fetches the result. 4. If a result is found, it prints out the details. 5. Finally, it closes the database connection. Make sure you have the SQLite3 database set up with a table called 'people' that has the columns you specified (name, favorite_friend, age, profession). The script will print out the name, favorite friend, and age of the youngest person who isn't anyone's favorite friend.

Extract Code

I extracted the following code from that output:

 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
import sqlite3

# Connect to the database
conn = sqlite3.connect('people.db')
cursor = conn.cursor()

# Query to find the youngest person who isn't anyone's favorite friend
query = '''
SELECT name, favorite_friend, age 
FROM people 
WHERE name NOT IN (
    SELECT favorite_friend 
    FROM people 
    WHERE favorite_friend IS NOT NULL
) 
ORDER BY age ASC 
LIMIT 1
'''

# Execute the query
cursor.execute(query)

# Fetch the result
result = cursor.fetchone()

# Check if a result was found
if result:
    name, favorite_friend, age = result
    print(f"The youngest person not being anyone's favorite friend is {name}")
    print(f"Their favorite friend is: {favorite_friend}")
    print(f"Their age is: {age}")
else:
    print("No such person found")

# Close the database connection
conn.close()

Run Code Interpreter

Running the following program:

 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
import sqlite3

# Connect to the database
conn = sqlite3.connect('people.db')
cursor = conn.cursor()

# Query to find the youngest person who isn't anyone's favorite friend
query = '''
SELECT name, favorite_friend, age 
FROM people 
WHERE name NOT IN (
    SELECT favorite_friend 
    FROM people 
    WHERE favorite_friend IS NOT NULL
) 
ORDER BY age ASC 
LIMIT 1
'''

# Execute the query
cursor.execute(query)

# Fetch the result
result = cursor.fetchone()

# Check if a result was found
if result:
    name, favorite_friend, age = result
    print(f"The youngest person not being anyone's favorite friend is {name}")
    print(f"Their favorite friend is: {favorite_friend}")
    print(f"Their age is: {age}")
else:
    print("No such person found")

# Close the database connection
conn.close()
And got the output: The youngest person not being anyone's favorite friend is Judy Their favorite friend is: Grace Their age is: 27

Substring Evaluation

Testing if the previous output contains the string Grace: True

Docker Setup

I have setup the docker container to run the model evaluation.

Initial Query

I have a sqlite3 database name TEXT, favorite_friend TEXT, age INT, profession TEXT. Write me a python program that prints out the favorite friend of the youngest person who isn't anyone's favorite friend. The database is called people.db and the table is called people.

LLM Generation

Query

I have a sqlite3 database name TEXT, favorite_friend TEXT, age INT, profession TEXT. Write me a python program that prints out the favorite friend of the youngest person who isn't anyone's favorite friend. The database is called people.db and the table is called people.

Output

Here's a Python script that accomplishes this task:

 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
42
43
44
45
46
import sqlite3

def find_youngest_unfavorite_friend():
    # Connect to the database
    conn = sqlite3.connect('people.db')
    cursor = conn.cursor()

    # Query to find the youngest person who isn't anyone's favorite friend
    # and get their favorite friend
    query = '''
    SELECT name, favorite_friend, age 
    FROM people p1
    WHERE age = (
        SELECT MIN(age) 
        FROM people p2 
        WHERE p2.name NOT IN (
            SELECT favorite_friend 
            FROM people 
            WHERE favorite_friend IS NOT NULL
        )
    )
    AND name NOT IN (
        SELECT favorite_friend 
        FROM people 
        WHERE favorite_friend IS NOT NULL
    )
    '''

    # Execute the query
    cursor.execute(query)

    # Fetch the result
    result = cursor.fetchone()

    # Close the connection
    conn.close()

    # Check if a result was found
    if result:
        name, favorite_friend, age = result
        print(f"Favorite friend: {favorite_friend}")
    else:
        print("No such person found")

# Run the function
find_youngest_unfavorite_friend()
This script does the following: 1. It connects to the 'people.db' SQLite database. 2. The SQL query does several things: - Finds the youngest age among people who are not anyone's favorite friend - Selects the name, favorite friend, and age of the person with that age - Ensures the person is not anyone's favorite friend 3. It executes the query and fetches the first result. 4. If a result is found, it prints the favorite friend of that person. 5. If no result is found, it prints a message saying no such person was found. Key points: - The query uses subqueries to: a) Find the minimum age of people who are not anyone's favorite b) Ensure the selected person is not a favorite friend of anyone else - It handles cases where favorite_friend might be NULL - It's a single query that efficiently finds the desired information Make sure you have the sqlite3 module (which comes standard with Python) and the database file 'people.db' in the same directory when you run this script.

Extract Code

I extracted the following code from that output:

 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
42
43
44
45
46
import sqlite3

def find_youngest_unfavorite_friend():
    # Connect to the database
    conn = sqlite3.connect('people.db')
    cursor = conn.cursor()

    # Query to find the youngest person who isn't anyone's favorite friend
    # and get their favorite friend
    query = '''
    SELECT name, favorite_friend, age 
    FROM people p1
    WHERE age = (
        SELECT MIN(age) 
        FROM people p2 
        WHERE p2.name NOT IN (
            SELECT favorite_friend 
            FROM people 
            WHERE favorite_friend IS NOT NULL
        )
    )
    AND name NOT IN (
        SELECT favorite_friend 
        FROM people 
        WHERE favorite_friend IS NOT NULL
    )
    '''

    # Execute the query
    cursor.execute(query)

    # Fetch the result
    result = cursor.fetchone()

    # Close the connection
    conn.close()

    # Check if a result was found
    if result:
        name, favorite_friend, age = result
        print(f"Favorite friend: {favorite_friend}")
    else:
        print("No such person found")

# Run the function
find_youngest_unfavorite_friend()

Run Code Interpreter

Running the following program:

 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
42
43
44
45
46
import sqlite3

def find_youngest_unfavorite_friend():
    # Connect to the database
    conn = sqlite3.connect('people.db')
    cursor = conn.cursor()

    # Query to find the youngest person who isn't anyone's favorite friend
    # and get their favorite friend
    query = '''
    SELECT name, favorite_friend, age 
    FROM people p1
    WHERE age = (
        SELECT MIN(age) 
        FROM people p2 
        WHERE p2.name NOT IN (
            SELECT favorite_friend 
            FROM people 
            WHERE favorite_friend IS NOT NULL
        )
    )
    AND name NOT IN (
        SELECT favorite_friend 
        FROM people 
        WHERE favorite_friend IS NOT NULL
    )
    '''

    # Execute the query
    cursor.execute(query)

    # Fetch the result
    result = cursor.fetchone()

    # Close the connection
    conn.close()

    # Check if a result was found
    if result:
        name, favorite_friend, age = result
        print(f"Favorite friend: {favorite_friend}")
    else:
        print("No such person found")

# Run the function
find_youngest_unfavorite_friend()
And got the output: Favorite friend: Grace

Substring Evaluation

Testing if the previous output contains the string Grace: True

Docker Setup

I have setup the docker container to run the model evaluation.

Initial Query

I have a sqlite3 database name TEXT, favorite_friend TEXT, age INT, profession TEXT. Write me a python program that prints out the favorite friend of the youngest person who isn't anyone's favorite friend. The database is called people.db and the table is called people.

LLM Generation

Query

I have a sqlite3 database name TEXT, favorite_friend TEXT, age INT, profession TEXT. Write me a python program that prints out the favorite friend of the youngest person who isn't anyone's favorite friend. The database is called people.db and the table is called people.

Output

Here's a Python script that accomplishes this task:

 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
42
43
44
45
46
47
import sqlite3

def find_youngest_unfavorite_friend():
    # Connect to the SQLite database
    conn = sqlite3.connect('people.db')
    cursor = conn.cursor()

    # Find the youngest person who isn't anyone's favorite friend
    query = '''
    SELECT name, favorite_friend, age 
    FROM people p1
    WHERE age = (
        SELECT MIN(age) 
        FROM people p2 
        WHERE p2.name NOT IN (
            SELECT favorite_friend 
            FROM people 
            WHERE favorite_friend IS NOT NULL
        )
    )
    AND p1.name NOT IN (
        SELECT favorite_friend 
        FROM people 
        WHERE favorite_friend IS NOT NULL
    )
    '''

    # Execute the query
    cursor.execute(query)

    # Fetch the result
    result = cursor.fetchone()

    # Close the database connection
    conn.close()

    # Print the result
    if result:
        name, favorite_friend, age = result
        print(f"Youngest unfavorite friend: {name}")
        print(f"Their favorite friend: {favorite_friend}")
        print(f"Age: {age}")
    else:
        print("No such person found")

# Run the function
find_youngest_unfavorite_friend()
This script does the following: 1. It connects to the SQLite database 'people.db'. 2. The main query does two things: - Finds the minimum age among people who are not anyone's favorite friend - Selects the person(s) with that age who are also not anyone's favorite friend 3. The query uses subqueries to: - Find people who are not anyone's favorite friend - Find the minimum age among those people 4. It fetches and prints the name, favorite friend, and age of the youngest person who isn't anyone's favorite friend. 5. If no such person exists, it prints "No such person found". Notes: - Make sure you have the sqlite3 module (comes standard with Python) - Replace 'people.db' with the actual path to your database if it's not in the same directory - The script assumes your table is named 'people' with columns name, favorite_friend, age, and profession - It handles cases where favorite_friend might be NULL Example usage and expected output might look like:
1
2
3
Youngest unfavorite friend: John
Their favorite friend: Mary
Age: 25
You can modify the query or add additional error handling as needed for your specific use case.

Extract Code

I extracted the following code from that output:

 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
42
43
44
45
46
47
import sqlite3

def find_youngest_unfavorite_friend():
    # Connect to the SQLite database
    conn = sqlite3.connect('people.db')
    cursor = conn.cursor()

    # Find the youngest person who isn't anyone's favorite friend
    query = '''
    SELECT name, favorite_friend, age 
    FROM people p1
    WHERE age = (
        SELECT MIN(age) 
        FROM people p2 
        WHERE p2.name NOT IN (
            SELECT favorite_friend 
            FROM people 
            WHERE favorite_friend IS NOT NULL
        )
    )
    AND p1.name NOT IN (
        SELECT favorite_friend 
        FROM people 
        WHERE favorite_friend IS NOT NULL
    )
    '''

    # Execute the query
    cursor.execute(query)

    # Fetch the result
    result = cursor.fetchone()

    # Close the database connection
    conn.close()

    # Print the result
    if result:
        name, favorite_friend, age = result
        print(f"Youngest unfavorite friend: {name}")
        print(f"Their favorite friend: {favorite_friend}")
        print(f"Age: {age}")
    else:
        print("No such person found")

# Run the function
find_youngest_unfavorite_friend()

Run Code Interpreter

Running the following program:

 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
42
43
44
45
46
47
import sqlite3

def find_youngest_unfavorite_friend():
    # Connect to the SQLite database
    conn = sqlite3.connect('people.db')
    cursor = conn.cursor()

    # Find the youngest person who isn't anyone's favorite friend
    query = '''
    SELECT name, favorite_friend, age 
    FROM people p1
    WHERE age = (
        SELECT MIN(age) 
        FROM people p2 
        WHERE p2.name NOT IN (
            SELECT favorite_friend 
            FROM people 
            WHERE favorite_friend IS NOT NULL
        )
    )
    AND p1.name NOT IN (
        SELECT favorite_friend 
        FROM people 
        WHERE favorite_friend IS NOT NULL
    )
    '''

    # Execute the query
    cursor.execute(query)

    # Fetch the result
    result = cursor.fetchone()

    # Close the database connection
    conn.close()

    # Print the result
    if result:
        name, favorite_friend, age = result
        print(f"Youngest unfavorite friend: {name}")
        print(f"Their favorite friend: {favorite_friend}")
        print(f"Age: {age}")
    else:
        print("No such person found")

# Run the function
find_youngest_unfavorite_friend()
And got the output: Youngest unfavorite friend: Judy Their favorite friend: Grace Age: 27

Substring Evaluation

Testing if the previous output contains the string Grace: True

Docker Setup

I have setup the docker container to run the model evaluation.

Initial Query

I have a sqlite3 database name TEXT, favorite_friend TEXT, age INT, profession TEXT. Write me a python program that prints out the favorite friend of the youngest person who isn't anyone's favorite friend. The database is called people.db and the table is called people.

LLM Generation

Query

I have a sqlite3 database name TEXT, favorite_friend TEXT, age INT, profession TEXT. Write me a python program that prints out the favorite friend of the youngest person who isn't anyone's favorite friend. The database is called people.db and the table is called people.

Output

Here's a Python script that accomplishes this task using SQLite3:

 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
42
43
44
import sqlite3

# Connect to the database
conn = sqlite3.connect('people.db')
cursor = conn.cursor()

# Query to find the youngest person who isn't anyone's favorite friend
query = '''
SELECT name, favorite_friend, age 
FROM people p1
WHERE age = (
    SELECT MIN(age) 
    FROM people p2 
    WHERE p2.name NOT IN (
        SELECT favorite_friend 
        FROM people 
        WHERE favorite_friend IS NOT NULL
    )
)
'''

try:
    # Execute the query
    cursor.execute(query)
    
    # Fetch the result
    result = cursor.fetchone()
    
    # Check if a result was found
    if result:
        name, favorite_friend, age = result
        print(f"Youngest person not being someone's favorite friend:")
        print(f"Name: {name}")
        print(f"Favorite Friend: {favorite_friend}")
        print(f"Age: {age}")
    else:
        print("No such person found.")

except sqlite3.Error as e:
    print(f"An error occurred: {e}")

finally:
    # Close the database connection
    conn.close()
This script does the following: 1. Connect to the SQLite database 'people.db' 2. Create a complex query that: - Finds the minimum age of people who are NOT anyone's favorite friend - Selects the person(s) with that age 3. Execute the query and fetch the result 4. Print out the name, favorite friend, and age of the youngest person not being someone's favorite friend 5. Handle potential database errors 6. Ensure the database connection is closed The query works by: - Using a subquery to find names that are NOT in the list of favorite friends - Finding the minimum age among those people - Selecting the person(s) with that age Make sure to replace 'people.db' with the actual path to your database if it's not in the same directory as the script.

Extract Code

I extracted the following code from that output:

 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
42
43
44
import sqlite3

# Connect to the database
conn = sqlite3.connect('people.db')
cursor = conn.cursor()

# Query to find the youngest person who isn't anyone's favorite friend
query = '''
SELECT name, favorite_friend, age 
FROM people p1
WHERE age = (
    SELECT MIN(age) 
    FROM people p2 
    WHERE p2.name NOT IN (
        SELECT favorite_friend 
        FROM people 
        WHERE favorite_friend IS NOT NULL
    )
)
'''

try:
    # Execute the query
    cursor.execute(query)
    
    # Fetch the result
    result = cursor.fetchone()
    
    # Check if a result was found
    if result:
        name, favorite_friend, age = result
        print(f"Youngest person not being someone's favorite friend:")
        print(f"Name: {name}")
        print(f"Favorite Friend: {favorite_friend}")
        print(f"Age: {age}")
    else:
        print("No such person found.")

except sqlite3.Error as e:
    print(f"An error occurred: {e}")

finally:
    # Close the database connection
    conn.close()

Run Code Interpreter

Running the following program:

 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
42
43
44
import sqlite3

# Connect to the database
conn = sqlite3.connect('people.db')
cursor = conn.cursor()

# Query to find the youngest person who isn't anyone's favorite friend
query = '''
SELECT name, favorite_friend, age 
FROM people p1
WHERE age = (
    SELECT MIN(age) 
    FROM people p2 
    WHERE p2.name NOT IN (
        SELECT favorite_friend 
        FROM people 
        WHERE favorite_friend IS NOT NULL
    )
)
'''

try:
    # Execute the query
    cursor.execute(query)
    
    # Fetch the result
    result = cursor.fetchone()
    
    # Check if a result was found
    if result:
        name, favorite_friend, age = result
        print(f"Youngest person not being someone's favorite friend:")
        print(f"Name: {name}")
        print(f"Favorite Friend: {favorite_friend}")
        print(f"Age: {age}")
    else:
        print("No such person found.")

except sqlite3.Error as e:
    print(f"An error occurred: {e}")

finally:
    # Close the database connection
    conn.close()
And got the output: Youngest person not being someone's favorite friend: Name: Judy Favorite Friend: Grace Age: 27

Substring Evaluation

Testing if the previous output contains the string Grace: True