forked from andrei-punko/java-interview-coding
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path07.sql
More file actions
20 lines (15 loc) · 722 Bytes
/
Copy path07.sql
File metadata and controls
20 lines (15 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
-- 07. Написать (разными способами) запрос, который выведет уникальные значения данного столбца
create table students (
ID int primary key,
NAME varchar(255) not null
);
insert into students (ID, NAME) values (1, 'Andrei');
insert into students (ID, NAME) values (2, 'Yulia');
insert into students (ID, NAME) values (3, 'Tatiana');
insert into students (ID, NAME) values (4, 'Andrei');
insert into students (ID, NAME) values (5, 'Elena');
insert into students (ID, NAME) values (6, 'Tatiana');
-- 1й способ:
select distinct name from students;
-- 2й способ:
select name from students group by name;