Self join Example

Display the hierarchy of all employees with rank

Create employee table

create table emp(
        id int,
                    fname varchar(16),
                    lname varchar(16),
                    e_level int
);

Insert data

joins.xlsx

Featuresort()sorted()
Works onLists onlyAny iterable (lists, tuples, dictionaries, strings, etc.)
ReturnsNoneNew sorted list
Modifies original?Yes (in-place)No
Usagelist.sort()sorted(iterable)

sort() example

numbers = [4, 1, 3, 2]
numbers.sort()
print(numbers)  # Output: [1, 2, 3, 4]

sorted()

Read More

Call Now