Since no one answers on TOF

-- create
CREATE TABLE EMPLOYEE (
  empId INTEGER PRIMARY KEY,
  name TEXT NOT NULL,
  dept TEXT NOT NULL
);

-- insert
INSERT INTO EMPLOYEE VALUES (0001, 'C1', 'Sales');
INSERT INTO EMPLOYEE VALUES (0005, 'A10', 'Sales');
INSERT INTO EMPLOYEE VALUES (0002, 'C10','Accounting');
INSERT INTO EMPLOYEE VALUES (0003, 'C100', 'Sales');
INSERT INTO EMPLOYEE VALUES (0004, 'A100', 'Sales');

-- fetch 
SELECT * FROM EMPLOYEE WHERE dept = 'Sales';

select * from employee
order by btrim ( name , '01234567890'), btrim ( upper(name) , 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') ;

Is it perfect ? no
Theres lots I dunno about his set up

but its AN answer that maybe he’ll see

3 Likes

SELECT *
FROM EMPLOYEE
ORDER BY
btrim(name, ‘0123456789’) ASC, – Extract the alphabetical prefix
CAST(btrim(name, ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’) AS INTEGER) ASC; – Extract and convert the numeric suffix

1 Like