A table contains certain columns. One of the columns is Division. The user enters a division name through a prompt. Write a query to satisfy below scenario:
If the value entered in prompt is 'a' or 'b', then all records should be displayed else, the records pertaining to that particular division should be displayed.
Solution:
The query would be written as follows:
select * from my_table
where
division = &division
OR
'^' = decode(&division,'a','^','b','^',&division)
Here any special character (like '^' in above query) can be choosed to give all results in case division value entered from prompt is either 'a' or 'b'.
negative regexp
-
if you want to grep anything except foo, use grep -v or negative lookahead
echo -e 'foo\nbar\nboz'|grep -P '^(?!.*foo).*$' bar boz it is just so
beautiful ...
1 month ago
2 comments:
Hеy theге would you mind stating which blog platform уou're working with? I'm looking tο
stаrt mу own blog in the near future but І'm having a tough time deciding between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design and style seems different then most blogs and I'm looking for sоmething complеtelу unique.
P.S Sorry for getting off-topic but I had to аsk!
Here iѕ my weblog; ipad 3 Screen repair petaling jaya
Thanκ you for another еxcеllent artіcle.
Where else mау anуbоԁу
gеt that kind of info in such an ideаl mannеr of writіng?
I've a presentation next week, and I'm on the ѕеarch for ѕuch infοrmatіon.
Feel free to surf to my pagе - ipad repair damansara
Post a Comment