Adding SQL query language

This commit is contained in:
Michael Reber
2019-11-18 14:05:53 +01:00
parent 026079a47d
commit 8c9a19ec97
354 changed files with 2466 additions and 0 deletions

View File

@@ -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);

View File

@@ -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));

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;

View File

@@ -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';

View File

@@ -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;

View File

@@ -0,0 +1,4 @@
/*Write a query to display all customers with a grade above 100.*/
SELECT *
FROM customer
WHERE grade > 100;