MySql Operators Chapter 2 Complete explain - 2025 shaileshsrn

 MySql Operators 

In this video, we are explain MySQL operators in simple and practical way there is mentions. basically there is many types of operators what is operators maybe you know about this but know just in simple words " Operators means:  

An operator is
a symbol, character, or keyword that tells a computer or calculator to perform a specific action, such as math (addition, subtraction) or logic (comparing values), so let's discuss in details. 

 

  •  Where Clause (Where Operators):  
  •  Used to specify a condition while fetching the data from a single tables or joining with 
multiple tables.  
  •  Not only used in the SELECT statements, but it is also used in the UPDATE,

Command: SELECT *from employees WHERE emp_id=101; 

 

Where the example mentioned above extracts all the columns from the table ‘employees’ 

    whose emp_id=101.  

 

 

  •  SQL Operators -Logical:

Operators

IllustrativeExample 

Condition

Results

AND

(10<20) AND (20>10)

Both True then Otherwise False

FALSE

OR

(10<20) OR (20>10)

Any one true 

TRUE

NOT

NOT(10<20)

Reverse if true the false> false then true

TRUE


Simple Example:  

 

  • #SQL Operators:

  • Logical :-   

  • #select* from studs where S_Name= 'Priya' and S_Marks=458; # AND : false 

    not show

  • select *from studs where S_Name= 'Shailu' OR S_Marks=456; # OR : True then

     show 

  • select *from studs where NOT S_Marks != 456;  # NOT : True then show

  • #select *from studs;

     

 

SQL Operators -Logical: 

Comparison Operators

Symbol 

Meaning 

=

Equal to

>

Greater than

>=

Greater than or equal to

<

Less than

<=

Less than or equal to

< > or !=

Not equal to


Simple Example:   

  • #SQL Logical Operators:- 

  • #select *from sregsnum where /*Cl_Roll_No = 82025 and */ Cl_Roll_

    No <=82089;

  • #select *from sregsnum where Category= 'GEN'; 

  • select *from sregsnum where Cl_Roll_No = 8208

 

  • SQL Operators -Special (vvi): 

Special Operators

Symbol 

Meaning 

BEETWEEN

Check an attribute value within range

LIKE

Check an attributes value matches a given string pattern 

IS NULL

Checks an attributes value is NULL 

IN 

Check an attributes value match any value within a value list 

DISTINCT

Limits values to unique values


Simple Queries:- 

  • #select *from sregsnum where Cl_Roll_No between 82020 and 82070;

  • #select *from sregsnum where Nm_of_Stud like "Raja Kumar";

  • select *from sregsnum where Nm_of_Stud like "A%";

  • #select *from sregsnum where Sl_No =null;

  • #select *from sregsnum where Cl_Roll_No in (82024, 82068, 82020);

  • #select distinct(Category) from sregsnum; 

  • select distinct(Cl_Roll_No) from sregsnum;

 

  • SQL Operators -Aggregations

Aggregations operators

Symbol 

Meaning 

Avg() 

Returns the average value from specified columns

Count()

Returns number of table rows 

Max()

Returns largest value among the records 

Min()

Returns smallest value among the records

Sum()

Returns the sum of specified columns values


Example of Aggregations : 

  • #select avg(Sl_No) from sregsnum;

  • #select avg(Study_Fees) from sregsnum;

  • #select count(*) from sregsnum; # Count total line in table =87

  • select min(Sl_No) from sregsnum;

  • select max(Sl_No) from  sregsnum;

  • select sum(Study_Fees) from sregsnum;

I hope this is helpful for you, thanks for watching and learning. 

 

 

 

Post a Comment

0 Comments