Suppose you have thousands of records in your database table and when you started it the data wasn't entered correctly and contains repetitions. Now you plan to clean up all the junk and create a new table.

--
-- Create a New Table with Non-Duplicate Values
--
-- Suppose you have thousands of records in your database table and when you
-- started it the data wasn't entered correctly and contains repetitions. Now you
-- plan to clean up all the junk and create a new table. Let's see how we do it.
--

create table emp2 as
    select * from emp where 1 group by lastname;

--
-- So it will create a new table "emp2" with only the employees having unique "last
-- names". You can sort your table with a different approach.
--