I would write the query (for a mysql relational DB) like this:
select email, IP, PCname, Type, OwnerName
from comps, owners
where OwnerName=*puthtmlInputTextValueHere*
and IP=*IPhtmlInputTextValueHere*
or Type=*typehtmlInputTextValueHere*
or pcname=*pcnameHtmlInputTextValueHere*
The requirement for query: Everything should be related by keys only, not by names or text values. How to do that? What does that mean?
The example I am given:
select o.email, c.pcname, c.ip, c.type
from owners o, comps c
where
(c.ownername=o.key)
and ( (c.ip=:1) or (c.type=:1) or (c.pcname=:1))
=:1 ---what is that part?
So, what must be after the where
part here?
Another example:
select pcname
from comps c, laps l, gen g
where (g.key=:1) and (l.key=g.LapKey) and (c.LapKey=l.key)
what is g.key=:1
? what is l.key
?
Normally, I use condition like WHERE columnName=someValue
but the requirement says not to use values, how to get a result then?!