I need to find 240 unique values in my table which contains 300.000 rows.
my unique values are like:
elephant,turtle,bird,turkey,snake
(I have list all of them)
I have tried:
Where column_name like 'snake'
or column_name like 'bird'
or column name like 'snake' etc...
but I'm not sure it is a good way to find my values.
CodePudding user response:
Try this:
> select distinct animal_name from your_300000_table;
So, suppose your table is this:
> create table animals (
animal_id numeric(10) primary key,
animal_type varchar(32) not null, -- here you have snake, bird, you name it
added_date datetime2,
location_lat numeric(11,8),
location_lon numeric(11,8)
);
> select distinct animal_type from animals;
> -- this will yield the expected result.
CodePudding user response:
If you want to find the row with the values from a list you can do
SELECT * FROM animals WHERE name IN ('elephant','cat');