In which case should I use dot(.) operator and IN clause ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In which case should I use dot(.) operator and IN clause ?

10th Feb 2017, 5:51 AM
Sonu Kumar
Sonu Kumar - avatar
3 Answers
+ 1
when you use a table alias you will need to use dot notation. a table alias is for instance. select * from schools s1 now if you ever need to use the schools table you can use s1. this is particularly useful when using joins
12th Feb 2017, 5:46 PM
Luke T
Luke T - avatar
+ 1
you use the in syntax when you either want to specify a range of values such as select * from schools where name in ('schoolname','schoolname','schoolname') or you can have a sub query such as select * from schools where ID in (select schoolid from schoolregions where region ='west')
12th Feb 2017, 6:44 PM
Luke T
Luke T - avatar
0
Dot is used as follows eg.: select tbl1.name, tbl2.address from tbl1 join tbl2 on tbl2.id = tbl1.id where tbl1.id = 123 also can be used to select from other database like db1.tabl1 syntax <optional database>.<optional table>.field If you'r operating with one db and table no need to use the database or table name. IN operator eg. select name from tbl1 where id id(123,456,789) is much nicer to use than alternative with OR select name from tbl1 where id = 123 or id = 456 or id = 789 hope this helps. Please correct me, but I think dot is not called operator at all. Don't know the right term though...
10th Feb 2017, 6:55 AM
Jani Sinkkonen
Jani Sinkkonen - avatar