MySQL - Where Clause
MySQL WHERE clause is used to filter the results from a SELECT, INSERT, UPDATE, or DELETE statement.
The syntax for the WHERE Clause in MySQL is:
SELECT field1, field2,...fieldN table_name1, table_name2...
[WHERE condition1 [AND [OR]] condition2.....
SELECT *
FROM studentmarks
WHERE Studentmarks = '555';
The result will be displayed as follows:
StudentId | Studentclass | Studentmarks |
---|---|---|
3 | eighth | 555 |
SELECT *
FROM studentrecord
WHERE City = 'Hyderabad'
AND PostalCode = 500046;
The result will be displayed as follows:
StudentId | StudentName | ParentName | Address | PostalCode | City |
---|---|---|---|---|---|
1 | Sanjana | jagannath | Banjara Hills | 500046 | Hyderabad |
SELECT StudentName
FROM studentinfo
WHERE StudentName = 'Ajaashi'
OR StudentName = 'Sahayana';
The result will be displayed as follows:
StudentName |
---|
Ajaashi |
Sahayana |
SELECT *
FROM studentrecord
WHERE (ParentName = 'Praveen' AND Address = 'Camel street')
OR (Postalcode = 700096);
The result will be displayed as follows:
StudentId | StudentName | ParentName | Address | PostalCode | City |
---|---|---|---|---|---|
2 | Shivanatini | Praveen | Camel street | 700096 | Kolkata |
MySQL - Grant_ Revoke Privilege
posted on 2019-11-26 23:15:04 - mysql Tutorials