SQL Assignment 2 Boolean
SQL Assignment 2 Boolean
SQL Assignment 2 Boolean
Ans = SELECT* FROM Customers WHERE grade>100;
Ques 2. Write a query statement to display all customers in New York who have
a grade value above 100.
Ans = SELECT* FROM Customers WHERE grade>100 AND city="New
York";
Ques 3. Write a SQL statement to display all customers, who are either belongs
to the city New York or had a grade above 100.
Ans = SELECT* FROM Customers WHERE grade>100 or city="New York";
Ques 4. Write a SQL statement to display all the customers, who are either
belongs to the city New York or not had a grade above 100.
Ans = SELECT* FROM Customers WHERE grade<100 or city="New York";
Ques 5. Write a SQL query to display those customers who are neither belongs
to the city New York nor grade value is more than 100.
Ans = SELECT cust_name FROM Customers WHERE city NOT IN ("New
York") AND grade<=100;
Ques 6. Write a SQL statement to display either those orders which are not
issued on date 2012-09-10 and issued by the salesman whose ID is 5005 and
below or those orders which purchase amount is 1000.00 and below.
Ans = SELECT* FROM Orders WHERE ord_date<>2012-09-10 AND
salesman_id<=5005 or purch_amt<=1000;
Ques 8. Write a SQL query to display all orders where purchase amount less
than a specified amount or order date and customer_id must not be greater than
a specified data and less than a specified ID respectively.
Ans = SELECT* FROM Orders WHERE purch_amt="purch_amt" AND
ord_date="ord_date" AND customer_id="customer_id";
Ques 9. Display all in reverse, where order dates equal to a specified date or
customer id greater than a specified number and purchase amount less than a
specified amount.
Ans =
Ques 11. Write a query in SQL to find the data of employees whose last name is
Dosni or Mardy.
Ans = SELECT*FROM EMP_DETAILS WHERE EMP_LNAME="Dosni" or
EMP_LNAME="Mardy";
Ques 12. Write a query in SQL to display all the data of employees that work in
department 47 or department 63.
Ans = SELECT* FROM EMP_DETAILS WHERE EMP_DEPT=47 or
EMP_DEPT=63;
Ques 13. Write a SQL statement to find those salesmen with all information
who come from the city either Paris or Rome.
Ans = SELECT*FROM Salesman WHERE city="Paris" or city="Rome";
Ques 14. Write a query to filter those salesmen with all information who comes
from any of the cities Paris and Rome.
Ans = SELECT*FROM Salesman WHERE city="Paris" or city="Rome";
Ques 15. Write a query to filter those salesmen with all information who likes to
leave other cities than Paris and Rome
Ans = SELECT* FROM Salesman WHERE city not in ("Paris","Rome");
Ques 16. Write a query to sort out those customers with all information whose
ID value is within any of 3007, 3008 and 3009.
Ans = SELECT* FROM Customers WHERE customer_id in (3007,3008,3009);
Ques 17. Write a SQL statement to find those salesmen with all information
who gets the commission within a range of 0.12 and 0.14
Ques 18. Write a query to filter all those orders with all information which
purchase amount value is within the range 500 and 4000 except those orders of
purchase amount value 948.50 and 1983.43
Ques 19. Write a SQL statement to find those salesmen with all other
information and name started with any latter 'A' and 'L'.
Ans = SELECT*FROM Salesman WHERE Name like"L%"or Name like "A
%";
Ques 20. Write a SQL statement to find those salesmen with all other
information and name started with other than any latter within 'A' and 'L'.
Ques 21. Write a SQL statement to find that customer with all information
whose name begin with the letter 'B'.
Ans = SELECT* FROM Customers WHERE cust_name like "B%";
Ques 22. Write a SQL statement to find all those customers with all information
whose names are ending with the letter 'n'.
Ans = SELECT* FROM Customers WHERE cust_name like "%n";
Ques 23. Write a SQL statement to find those salesmen with all information
whose name containing the 1st character is 'N' and the 4th character is 'l' and
rests may be any character.
Ans = SELECT*FROM Salesman WHERE Name like"N__l%";
Ques 24. Write a SQL statement to find that customer with all information who
does not get any grade except NULL.
Ans = SELECT* FROM Customers WHERE grade is NULL;
Ques 25. Write a SQL statement to find that customer with all information who
gets a grade except NULL value.
Ans = SELECT* FROM Customers WHERE grade is NOT NULL;
Ques 26. Write a query in SQL to display all the data of employees whose last
name begins with an 'D'.
Ans = SELECT* FROM EMP_DETAILS WHERE EMP_LNAME like "D%";