Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
0
1
00:00:00,680 --> 00:00:07,460
Except, operator, is you used to written all rows in the first select statement and then it removes all
1
2
00:00:07,460 --> 00:00:10,040
the rows that are present in the second select statement.
2
3
00:00:10,280 --> 00:00:16,820
So basically, if you have one table, it will first take out all the rows that you wanted from that
3
4
00:00:16,820 --> 00:00:17,210
table.
4
5
00:00:17,750 --> 00:00:23,990
And after that, it will remove the rows that are present in the select statement of the second table.
5
6
00:00:24,590 --> 00:00:26,990
So basically it is combining the two tables.
6
7
00:00:27,110 --> 00:00:32,510
In this sense, it is removing the parts of table 2 from the table 1, the syntax.
7
8
00:00:32,510 --> 00:00:33,680
for this goes like this.
8
9
00:00:33,920 --> 00:00:39,170
You mentioned the first select statement, which is select the expressions from table one.
9
10
00:00:40,440 --> 00:00:43,270
You can specify where condition if you want to, then we will write
10
11
00:00:43,290 --> 00:00:50,500
the keyword, except after this, you'll write the second select statement, which can work on the second
11
12
00:00:50,520 --> 00:00:50,850
table.
12
13
00:00:51,360 --> 00:00:53,850
Important thing to note here is the expression 1
13
14
00:00:53,850 --> 00:01:00,240
expression 2 that you write in the first table should be same as the expressions in the second table
14
15
00:01:00,420 --> 00:01:01,500
that you're selecting.
15
16
00:01:03,000 --> 00:01:09,360
Let us look at example, how this is used, for example, if you want to find out the customer IDs from
16
17
00:01:09,360 --> 00:01:16,350
the sales table for which you do not have the customer details in your customer table, we will use
17
18
00:01:16,350 --> 00:01:20,300
the except keyword here will first select customer id from the sales table.
18
19
00:01:20,340 --> 00:01:22,650
This will give us all the customer I.D. from this table.
19
20
00:01:23,330 --> 00:01:30,810
Then we will write except those customer IDs for which we have data in the customer table so those will
20
21
00:01:30,810 --> 00:01:31,320
be removed.
21
22
00:01:31,540 --> 00:01:35,910
Only those customer I.D. will remain for which we do not have the data in customer table
22
23
00:01:35,910 --> 00:01:37,700
Let us go and write this.
23
24
00:01:38,130 --> 00:01:42,420
So let's start writing select customer id
24
25
00:01:47,700 --> 00:01:50,030
from the first table, sales table
25
26
00:01:52,530 --> 00:01:53,190
except
26
27
00:01:56,610 --> 00:01:59,610
customer Ids from customer table.
27
28
00:02:06,860 --> 00:02:11,050
And let us order them by customer ids
28
29
00:02:19,500 --> 00:02:22,470
So you can see when I run this query, in the ResultSet.
29
30
00:02:23,760 --> 00:02:29,580
10315 is present because it is present in the sales table and not present in the customer
30
31
00:02:29,580 --> 00:02:35,100
table, 10375 is not present because it is present in both the tables.
31
32
00:02:36,060 --> 00:02:39,950
One zero four zero is not present because it is not present in the sales table itself.
32
33
00:02:40,980 --> 00:02:46,620
So all the customer ids for which you do not have data in the customer table are here with you.
33
34
00:02:48,310 --> 00:02:52,180
This is the except operator, next we will look at the union operator.
3557
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.