def test_table_addition(persons, orders):
    "Tests unstructured ways of joining tables together."
    # Create two tables to union together.
    employees_norway = Table(('E_ID', str), ('E_Name', str))
    employees_norway.insert('01', 'Hansen, Ola')
    employees_norway.insert('02', 'Svendson, Tove')
    employees_norway.insert('03', 'Svendson, Stephen')
    employees_norway.insert('04', 'Pettersen, Kari')
    employees_usa = Table(('E_ID', str), ('E_Name', str))
    employees_usa.insert('01', 'Turner, Sally')
    employees_usa.insert('02', 'Kent, Clark')
    employees_usa.insert('03', 'Svendson, Stephen')
    employees_usa.insert('04', 'Scott, Stephen')
    # Test union function on tables.
    union(employees_norway('E_Name'), employees_usa('E_Name')).print()
    union(employees_norway('E_Name'), employees_usa('E_Name'), True).print()
    # Test select into functionality.
    backup = Table(*persons.schema)
    persons.into(backup)
    backup.print()
    backup.truncate()
    persons.select('LastName', 'FirstName').into(backup)
    backup.print()
    # Test select into with where and join clauses.
    backup = Table(('LastName', str), ('FirstName', str))
    persons.where(ROW.City == 'Sandnes') \
           .select('LastName', 'FirstName').into(backup)
    backup.print()
    person_orders = Table(('Persons.LastName', str), ('Orders.OrderNo', int))
    inner_join(ROW.Persons.P_Id == ROW.Orders.P_Id,
               Persons=persons, Orders=orders) \
               .select('Persons.LastName', 'Orders.OrderNo') \
               .into(person_orders)
    person_orders.print()
Tests unstructured ways of joining tables together.
recipes/Python/577825_Rudimentary_Database_Engine/recipe-577825.py