WHERE clause is used to collect or update or manage the records from the table based on some specified condition .
Here is the table with few rows.
id
name
class
mark
sex
1
John Deo
Four
75
female
2
Max Ruin
Three
90
male
3
Arnold
Three
55
male
4
Krish Star
Four
60
female
5
John Mike
Four
60
female
6
Alex John
Four
55
male
SELECT query with LIMIT and order by with WHERE condition checking using BETWEEN range
To get only the records of Class Four students.
SELECT * FROM student WHERE class='Four'
Here is the result
id
name
class
mark
sex
1
John Deo
Four
75
female
4
Krish Star
Four
60
female
5
John Mike
Four
60
female
6
Alex John
Four
55
male
10
Big John
Four
55
female
15
Tade Row
Four
93
male
16
Gimmy
Four
93
male
21
Babby John
Four
69
female
31
Marry Toeey
Four
93
male
This will return all the records from the table name=student of class=Four. This is what we require to get all the records of fourth standard students.
WHERE with AND
More than one condition can be added to the where clause by using various logical expressions like AND, OR, < ( less than ), greater than (> ) etc.
Collect all the records of students of fourth standard who have scored mark more than 70.
SELECT * FROM student WHERE class='Four' AND mark >70
This search will return us all the records for which inside the name field 'John' is available. John name can be any where within the name column value.
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com
Raju
11-04-2013
Can we use Where condition linking more that one table?
wale
23-02-2014
I have 12 tables with the same number of fields and field names. I want to sum one of those fields that have numerical values in all tables. How can I accomplish the task.
Ivan
13-09-2014
Anyone can help me how to resolve this issue?? I am getting a type mismatch with the below syntax... I dont know how to resolve it..
adoCompName.RecordSource = "SELECT * FROM Tbl_Comp_Dtl WHERE CompName = ' * " & Text1.Text & " '"
adoCompName.Refresh