Question

In: Computer Science

You can join tables using the WHERE clause, the EXISTS operator, or the IN clause. Which...

  1. You can join tables using the WHERE clause, the EXISTS operator, or the IN clause. Which one is the easiest for you to understand? Why?
  2. The OR and AND operators are used in compound conditions. Is there any relationship between these operators and the ALL and ANY operators?

Solutions

Expert Solution

We can use where clause to join tables like by using sub queries, Actually here clause is used to filter the records .It is not compulsory that every time in the where clause we should use sub queries, where clause is used to apply conditions and used to extract only those records that fulfil l a specified condition.

Exist is logical operator which is used to check the result of the sub query, it will return true if the sub query returns one or more rows, otherwise it will return false ie., if the sub query doesn't return any row it will return false.

In is used along with the Where Clause ,it is used to specify multiple values in a where clause.it is used to compare the values returning from the subquery .it is used to match the values returning from the subquery to the values matching the where clause column. It is a shorthand for multiple OR conditions.

Both are easy to understand "in" has its own function and "Exists" has it's own function .Both of them are used at different problems in the sql .

"AND" and "OR" operators are used along with the where clause to filter records based on more than one condition. "AND" operator is used to specify more then one condition and it will displays the records if all the conditions used in "AND" are satisfied, Where as "OR" is also used to specify more than one condition but here if any one of the condition used in "OR" is satisfied then it will displays the records.

"ALL" and "ANY" operators are used in the WHERE or HAVING clause. ALL is a logical operator it returns true if all of the subquery values meets the condition .it is used to compare a value to all values in another value set.it is same as AND operator but ALL used to test the value set where as AND is used to test multiple condition in where clause. ANY is logical operator it returns true if any of the subquery value meets the condition .it is same as the "OR" operator but ANY is used to compare a value to any values in a list as per condition where as "OR" is use to combine multiple conditions in where clause.


Related Solutions

Write a SELECT statement that returns these columns using a JOIN of three tables: order_date from...
Write a SELECT statement that returns these columns using a JOIN of three tables: order_date from the orders table shipped_date from the orders table order_qty from the order_details table title from the items table artist from the items table unit_price from the items table Result table should be in order of order_date in ascending order
Propositional Logic Using operator properties and other logical equivalences (not truth tables), prove these statements. 1....
Propositional Logic Using operator properties and other logical equivalences (not truth tables), prove these statements. 1. ((p→r)∧(q→r)∧(p∨q))→r (tautology) 2. ¬(q→p)∧(p∧q∧s→r)∧p (contradiction) 3. (p→q)∧(p→r)≡p→(q∧r)
c++ using class... define operator overloading and give simple example how we can use operator overloading...
c++ using class... define operator overloading and give simple example how we can use operator overloading by writing simple program in which different operators are used to add, subtract, multiply and division.
Using graphical analysis, explain how the decision to join a monetary union can be justified
Using graphical analysis, explain how the decision to join a monetary union can be justified
When can the Coase Theorem properly handle a situation where an externality exists? Provide an example....
When can the Coase Theorem properly handle a situation where an externality exists? Provide an example. In what types of situations can the Coase Theorem not properly handle an externality? How can they be addressed instead?
Password hashes can be reversed using Rainbow Tables. Suppose a file (English text) is encrypted using...
Password hashes can be reversed using Rainbow Tables. Suppose a file (English text) is encrypted using a password, using the following scheme: The password is hashed, and the hash is used to encrypt the file via AES. The cipher is stores, the password and the hash are thrown away. Explain: 1. Dictionary attacks can be used to recover the password(how?) 2. Rainbow tables are not usable – why? 3. Rainbow tables can be used, if the file has a known...
In this question using c++, you have to design the Pascal triangle where you can create...
In this question using c++, you have to design the Pascal triangle where you can create a list of coefficients of a binomial of any size that is passed to the constructor. Data members and member functions of this class are of your design choice. You need to use only pointers and pointers to pointers (do not use regular array notations). Create a two-dimensional array in the heap memory (which creates a dynamic memory). Use an application program to print...
Outline the opportunity that exists at the bottom of the economic pyramid. Can you think of...
Outline the opportunity that exists at the bottom of the economic pyramid. Can you think of a firm or existing product that can be modified to become profitable in the developing world?
Which of the perspectives on whether or not God exists seems the most untenable to you?...
Which of the perspectives on whether or not God exists seems the most untenable to you? List two reasons why you could not accept this untenable viewpoint.
What single query can get data from 4 tables , using SUM or COUNT
What single query can get data from 4 tables , using SUM or COUNT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT