Adding SQL query language
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
/*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. */
|
||||
SELECT *
|
||||
FROM orders
|
||||
WHERE NOT((ord_date ='2012-08-17'
|
||||
OR customer_id>3005)
|
||||
AND purch_amt<1000);
|
||||
@@ -0,0 +1,7 @@
|
||||
/*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.*/
|
||||
SELECT *
|
||||
FROM orders
|
||||
WHERE(purch_amt<200 OR
|
||||
NOT(ord_date>='2012-02-10'
|
||||
AND customer_id<3009));
|
||||
@@ -0,0 +1,7 @@
|
||||
/*Write a SQL query to display order number, purchase amount, achived, the unachieved percentage for those order
|
||||
which exceeds the 50% of the target value of 6000. */
|
||||
SELECT ord_no,purch_amt,
|
||||
(100*purch_amt)/6000 AS "Achieved %",
|
||||
(100*(6000-purch_amt)/6000) AS "Unachieved %"
|
||||
FROM orders
|
||||
WHERE (100*purch_amt)/6000>50;
|
||||
@@ -0,0 +1,4 @@
|
||||
/*Write a SQL query to display those customers who are neither belongs to the city New York nor grade value is more than 100. */
|
||||
SELECT *
|
||||
FROM customer
|
||||
WHERE NOT (city = 'New York' OR grade>100);
|
||||
@@ -0,0 +1,4 @@
|
||||
/*Write a SQL statement to display all customers, who are either belongs to the city New York or had a grade above 100. */
|
||||
SELECT *
|
||||
FROM customer
|
||||
WHERE city = 'New York' OR grade>100;
|
||||
@@ -0,0 +1,5 @@
|
||||
/*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. */
|
||||
SELECT *
|
||||
FROM customer
|
||||
WHERE city = 'New York' OR NOT grade>100;
|
||||
@@ -0,0 +1,7 @@
|
||||
/*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 505 and below or those orders which purchase amount is 1000.00 and below.*/
|
||||
SELECT *
|
||||
FROM orders
|
||||
WHERE NOT ((ord_date ='2012-09-10'
|
||||
AND salesman_id>505)
|
||||
OR purch_amt>1000.00);
|
||||
@@ -0,0 +1,6 @@
|
||||
/*Write a SQL statement to display salesman_id, name, city and commission who gets the
|
||||
commission within the range more than 0.10% and less than 0.12%.*/
|
||||
SELECT salesman_id,name,city,commission
|
||||
FROM salesman
|
||||
WHERE (commission > 0.10
|
||||
AND commission< 0.12);
|
||||
@@ -0,0 +1,4 @@
|
||||
/*Write a query in SQL to display all the data of employees that work in department 47 or department 63.*/
|
||||
SELECT *
|
||||
FROM emp_details
|
||||
WHERE emp_dept = 47 OR emp_dept = 63;
|
||||
@@ -0,0 +1,4 @@
|
||||
/*Write a query in SQL to find the data of employees whose last name is Dosni or Mardy.*/
|
||||
SELECT *
|
||||
FROM emp_details
|
||||
WHERE emp_lname ='Dosni' OR emp_lname= 'Mardy';
|
||||
@@ -0,0 +1,4 @@
|
||||
/*Write a query statement to display all customers in New York who have a grade value above 100.*/
|
||||
SELECT *
|
||||
FROM customer
|
||||
WHERE city = 'New York' AND grade>100;
|
||||
@@ -0,0 +1,4 @@
|
||||
/*Write a query to display all customers with a grade above 100.*/
|
||||
SELECT *
|
||||
FROM customer
|
||||
WHERE grade > 100;
|
||||
Reference in New Issue
Block a user