1
00:02.060 --> 00:04.280
So let's today.

2
00:06.830 --> 00:13.820
Uh, continue with our the next, uh, topics and data.

3
00:13.820 --> 00:15.530
We can say that as a.

4
00:17.810 --> 00:19.880
Operators in SQL server.

5
00:20.210 --> 00:23.390
So we have created this table, right.

6
00:23.390 --> 00:27.770
We have created this table in inserted the data into the same.

7
00:27.770 --> 00:31.870
So let me select the data into the table.

8
00:32.770 --> 00:36.340
So we have this data will be available with us.

9
00:37.060 --> 00:41.830
Now what are the different types of operators in SQL server.

10
00:42.190 --> 00:50.530
So there are basically five different types of operators are available in SQL server that are arithmetic

11
00:50.530 --> 00:51.280
operators.

12
00:51.280 --> 00:52.960
Relational operators.

13
00:53.280 --> 00:55.140
Logical operators.

14
00:55.290 --> 00:59.220
Spatial operators and set operators.

15
00:59.910 --> 01:03.930
So now let's see each of them one by one.

16
01:04.470 --> 01:15.390
So whenever we see is an arithmetic operator plus minus multiply by divided by n modulus theta are known

17
01:15.390 --> 01:17.070
as arithmetic operators.

18
01:17.530 --> 01:19.450
Then in relational operators.

19
01:19.570 --> 01:26.110
Which means it is used for comparing data like less than, greater than, greater than, equal to,

20
01:26.110 --> 01:28.750
less than, equal to, equal to and not equal to.

21
01:29.410 --> 01:38.050
Whereas logical operators we can say that and or and not in in spatial operators we can say that between

22
01:38.050 --> 01:45.980
in like is any or and exist in set operators are union union or intersect and accept.

23
01:46.550 --> 01:50.510
So let's see now.

24
01:50.510 --> 02:00.740
So for retrieving the data from the database or in the SQL table we are using the select command right.

25
02:01.580 --> 02:06.640
So for that select command is used to fetch the data from the table.

26
02:06.880 --> 02:12.580
Using select command we can fetch all the columns and or some specific columns.

27
02:12.790 --> 02:14.680
Whichever we are mentioning.

28
02:15.730 --> 02:20.710
And using select command we can fetch all the rows or specified rows.

29
02:21.040 --> 02:23.560
To do select only specify rows.

30
02:23.620 --> 02:28.510
We are using the where condition right now.

31
02:28.510 --> 02:30.480
Let's take example.

32
02:30.960 --> 02:32.910
So what does this statement do.

33
02:32.940 --> 02:34.320
Select star from table name.

34
02:34.320 --> 02:37.080
It will retrieve all the data from the table name.

35
02:40.140 --> 02:45.030
It means this command will fetch all columns and all rows of the table.

36
02:45.300 --> 02:48.030
Now let's see the example.

37
02:48.030 --> 02:52.830
Display all data from the EMP table so we can simply do.

38
02:55.270 --> 02:58.660
Select star from EMP.

39
03:00.250 --> 03:06.280
So this will display all the rows and all the columns from the EMP table.

40
03:06.400 --> 03:07.270
Right.

41
03:07.270 --> 03:09.640
Because we have mentioned over here star.

42
03:11.020 --> 03:13.060
Now let's see another example.

43
03:13.720 --> 03:17.320
Display employee names and their salaries from the EMP table.

44
03:17.350 --> 03:23.650
So over here, which column is used for employee name ename and for salary cell column.

45
03:23.650 --> 03:24.190
Right.

46
03:24.190 --> 03:26.170
So we need to mention.

47
03:29.140 --> 03:34.660
Select Ename comma salary from EMP.

48
03:37.240 --> 03:39.550
So now let's execute this query.

49
03:40.060 --> 03:46.450
So it will give us only two columns because that we have mentioned in our Select statement.

50
03:47.920 --> 03:51.520
Now display employee names and their age from the EMP table.

51
03:51.520 --> 03:57.580
So what we have to do we just do copy paste in in place of salary.

52
03:57.580 --> 04:00.730
We will mention over here age right.

53
04:01.630 --> 04:06.090
So let me select the data from the table Okay.

54
04:06.090 --> 04:07.560
It is not a valid.

55
04:10.620 --> 04:16.140
So in this particular table age column is not given.

56
04:16.140 --> 04:20.490
So in place of age we can mention higher date right.

57
04:20.490 --> 04:24.390
So let me correct it.

58
04:30.880 --> 04:32.140
Let's see.

59
04:33.580 --> 04:34.570
Perfect.

60
04:34.570 --> 04:37.750
So now let's execute this particular query.

61
04:38.920 --> 04:45.220
You will get employee name and higher date right now very close.

62
04:45.220 --> 04:49.390
So if till now you haven't specified any where clause over here.

63
04:49.390 --> 04:49.990
Right.

64
04:50.110 --> 04:53.850
So where clause select column from table name where condition.

65
04:53.850 --> 04:59.460
So it will filter only those data which is matched with that particular where condition.

66
04:59.910 --> 05:08.220
So over here you can see it is used to get specific row or rows from the table based on a certain condition.

67
05:09.030 --> 05:14.580
Condition should be some expression or relation which should result in true or false.

68
05:14.580 --> 05:17.960
So for every row of a table, condition will be evaluated.

69
05:19.400 --> 05:23.390
If the condition is true, the corresponding row is selected.

70
05:23.390 --> 05:27.950
But if the condition is false, that row is not selected, right?

71
05:30.980 --> 05:33.920
Now let's see some of the examples over here.

72
05:34.520 --> 05:37.580
So let me first select the entire table.

73
05:41.430 --> 05:47.550
Display the detail of the employee whose employee ID is 103.

74
05:47.550 --> 05:48.060
Right.

75
05:48.060 --> 05:52.770
So what we have to do, we just need to mention over here when where?

76
05:55.440 --> 05:58.140
What is the EMP number.

77
05:58.140 --> 05:58.560
Right.

78
05:58.560 --> 06:03.270
So EMP number equal to 103.

79
06:06.860 --> 06:09.140
So this row got selected right.

80
06:09.140 --> 06:18.710
It has filter only one row because we have mentioned that one in our Select statement where clause right

81
06:19.460 --> 06:20.690
now name is Vijay.

82
06:20.690 --> 06:23.960
So is there any Vijay is there in the table.

83
06:24.530 --> 06:28.430
Let me check it.

84
06:34.290 --> 06:39.150
So we can say we can retrieve in place of Vijay.

85
06:39.180 --> 06:40.620
We can retrieve Smith.

86
06:40.800 --> 06:41.670
Right?

87
06:41.880 --> 06:55.190
So what we have to do in place of EMP number, we need to mention e name equal to Smith.

88
06:55.190 --> 06:56.000
Right?

89
06:56.420 --> 06:58.460
So it will retrieve the Smith data.

90
06:58.460 --> 06:59.060
Right?

91
07:03.080 --> 07:11.840
Now display the employee of the display, the details of the employees earning more than 2500.

92
07:12.350 --> 07:18.490
So here we can mention the salary, right?

93
07:18.940 --> 07:20.200
Salary.

94
07:23.320 --> 07:24.640
Greater than.

95
07:27.850 --> 07:30.250
Let's see what result it will give.

96
07:31.960 --> 07:35.860
So all these record salary is greater than 2500, right.

97
07:38.020 --> 07:40.870
So this is a simple statements.

98
07:41.450 --> 07:44.540
Now let's see another question.

99
07:44.540 --> 07:48.920
Display employee details of those who joined after 2020 right.

100
07:49.220 --> 07:56.570
So select star from employee where higher date.

101
08:00.080 --> 08:01.460
Greater than

102
08:03.410 --> 08:05.900
0101 dash.

103
08:05.900 --> 08:08.290
0101-2020.

104
08:08.320 --> 08:12.340
Let's try this one and you can see.

105
08:12.340 --> 08:12.700
Right.

106
08:12.700 --> 08:13.540
Perfect.

107
08:13.540 --> 08:18.430
All these employees are joining after 2020 right.

108
08:20.590 --> 08:23.440
And for before 2020 we can say that.

109
08:26.320 --> 08:30.080
It should be less than 2020 right?

110
08:31.760 --> 08:35.540
So all these employee are joined before 2020 right.

111
08:40.160 --> 08:48.050
So this is how we can write this basic Select statements using the Where condition.

112
08:48.050 --> 08:49.040
Let me.

113
08:53.630 --> 08:54.890
Just stop the recording.