Sunteți pe pagina 1din 5

Set 1

1. Create your own table EMP_(Your Roll No) and Dept_(Your roll no) with the same structure and data
as EMP and DEPT table of SCOTT user. Now perform the following queries:
a) Display the employee name and department name of each employee.
b) Display the maximum and minimum salaries of each department.
c) List the names of the employee whose salary grade is B.
d) List the name of each department along with number of employees.
e) Make initial letters of this string “hello world” capital letter (using Dual).
f) Display today’s date in the following formats: 30-November-2017.

2. Create your own table EMP_(Your Roll No) with the same structure and data as EMP.
Now perform the following queries:
a) Display employees name and <sal + comm> from emp table and give the heading gross_salary
b) Display name and Increased_Salary of each MANAGER. Increase is made by 15%.
c) Display details of all employees who are either PRESIDENT or MANAGER or ANALYST.
d) Display names and salaries of all employees whose salary lies in between 900 and 1700.
e) Display names and salaries of all employees whose salary does not lie in between 800 and 1600.
f) Display names of those employees whose name’s last character is ‘A’.
g) Display those employees information who are clerk and from department number 30.
h) Find the length of this string “Aliah University” (using dual).

3. Create your own tables Supp_(Roll No), Item_(Roll No), Ord_Mas_(Roll No) & Ord_Det_(Roll No)
with the same structure and data as Supp, Item, Ord_Mas, Ord_Det tables of the SCOTT user.
a) Find all orders in which order dates are between ‘01.01.2009’ and ‘31.12.2009’.
b) Find all items with a ‘D’ in their name.
c) Write a SQL query that selects all Order along with Supplier Name.
d) Find orders with ‘Cabinet’ as an Item.
e) Write a SQL query that selects total price for each item based on qty on stock.
f) Display this string “hello” in capital letters.
g) Find the square root of 361.

4. Create your own tables Supp_(Roll No), Item_(Roll No), Ord_Mas_(Roll No) & Ord_Det_(Roll No)
with the same structure and data as Supp, Item, Ord_Mas, Ord_Det tables of the SCOTT user.
a) Find number of orders taken by each supplier.
b) Find total number of orders placed for each year.
c) Display O_No, O_Date, I_No, I_Name, Qty, I_Price and Total Price.
d) Display the names of items ordered in the order no. 30001.
e) Find items that are cheaper than ‘Monitor’.
f) Display your name in upper case letters (using Dual).
g) Find today’s date.
5. Create your own tables Supp_(Roll No), Item_(Roll No), Ord_Mas_(Roll No) & Ord_Det_(Roll No)
with the same structure and data as Supp, Item, Ord_Mas, Ord_Det tables of the SCOTT user.
a) Find the total price amount for each order.
b) Find the name of the supplier who has got maximum number of order so far.
c) Show Year wise Total Order Price Amount for each Supplier.
d) Find order numbers on which order placed for ‘Monitor’ or ‘Keyboard’.
e) Find suppliers who have got the maximum ordered (in price).
f) Make the initial letters capital for this string “welcome to aliah university”.
g) Find the value of 5 to the power 3.

6. Create your own tables Supp_(Roll No), Item_(Roll No), Ord_Mas_(Roll No) & Ord_Det_(Roll No)
with the same structure and data as Supp, Item, Ord_Mas, Ord_Det tables of the SCOTT user.
a) Find the total price amount for each month in 2009.
b) Find orders that are taken by the supplier ‘Binary’ and ‘Sysquest’.
c) Find the names of the items, which do not included in orders.
d) Write a SQL query that selects total price for each item based on qty on stock.
e) Find delivery date for each order. Assume the delivery date is one month from the order date.
f) Display your name in lower case letters.
g) Display today’s date.

7. a) Create your own tables EMP_ (Your Roll No), DEPT_ (Your Roll No), SALGRADE_ (Your Roll
No) from EMP, DEPT, and SALGRADE table of SCOTT user.

1. 2. Find out the minimum salary of each department from EMP table.
2. Display total salary of each department in descending order.
3. Display total salary of ACCOUNTING department.
4. Find out the number of employees of a particular department.
5. Display names and department name of all MANAGERS.
6. a) Display today’s date in the following formats: 30- November – 2017.
b) Find the length of this string “Aliah University”.

8. Create your own tables EMP_ (Your Roll No), DEPT_ (Your Roll No), SALGRADE_ (Your Roll
No) from EMP, DEPT, and SALGRADE table of SCOTT user.

1. Find out the average salary of each department from EMP table.
2. Display total salary of each department in ascending order.
3. Display total salary of ACCOUNTING department.
4. Find out the number of employees of a particular department.
5. Display names, dept num and department name of all MANAGERS.
6.
a) Display today’s date in the following formats: 30th November 2017.
b) Display your name with initial letters capital form.

9. Create the following tables

a) Client_master_(Your Roll No)

Column Name Data Type Size Constraints


------------------ --------------- -------- ---------------------------------------------------------
client_no varchar2 6 Primary Key, First letter must starts with ‘C’.
name varchar2 20 Not Null
address varchar2 20 Null
city varchar2 15 Not Null
pin number 6 Not Null

b) Product_master_(Your Roll No)

Column Name Data Type Size Constraints


------------------ --------------- -------- ---------------------------------------------------------
product_no varchar2 6 Primary Key, First letter must starts with ‘P’.
description varchar2 20
sell_price number 8, 2 Not Null, can’t be 0

c) (i) Remove the spaces of this string “Hello ”.

(ii) Find the ceiling value of 27.79.

10. Create the following tables

a) Client_master_(Your Roll No)

Column Name Data Type Size Constraints


------------------ --------------- -------- ---------------------------------------------------------
client_no varchar2 6 Primary Key, First letter must starts with ‘C’.
name varchar2 20 Not Null
address varchar2 20 Null
city varchar2 15 Not Null
pin number 6 Not Null

b) Sales_order_(Your Roll No)

Column Name Data Type Size Constraints


------------------ --------------- -------- ---------------------------------------------------------
order_no varchar2 6 Primary Key, First letter must starts with ‘O’.
order_dt date
Foreign Key references client_no of Client_master
client_no varchar2 6
table
delivery_addr varchar2 20
delivery_type char 1 ‘P’ or ‘F’, default ‘F’
delivery_dt date Can’t be less than order_dt
Value must be in (‘processed’ , ‘fulfilled’, ‘back
order_status varchar2 10
order’, ‘cancelled’)
c) (i) Make the initial letters capital for this string “welcome to aliah university”.
(ii) Find the value of 7 to the power 3.

11. Create your own tables Supp_(Roll No), Item_(Roll No), Ord_Mas_(Roll No) & Ord_Det_(Roll No)
with the same structure and data as Supp, Item, Ord_Mas, Ord_Det tables of the SCOTT user.
a. Display item information with appropriate column aliases.
b. Find all suppliers who are from ‘WB’.
c. Find all orders in which order dates are between ‘01.01.2008’ and ‘31.12.2008’.
d. Find all suppliers whose names start with the letter S.
e. Find all items with a ‘D’ in their name.
f. Find all items whose stock quantity is less than 50.
g. Find the floor value of 31.57 (using dual).
h. Remove the spaces of this string “Hello ”.

12. Create your own tables Supp_(Roll No), Item_(Roll No), Ord_Mas_(Roll No) & Ord_Det_(Roll No)
with the same structure and data as Supp, Item, Ord_Mas, Ord_Det tables of the SCOTT user.
a. Sort all items in descending order by their price.
b. Display all suppliers from ‘WB’ alphabetically.
c. Find delivery date for each order. Assume the delivery date is one month from the order date.
d. Display unique order numbers from Ord_Det_(Roll No) table.
e. Display unique suppliers from Order_Mas_(Roll No) table.
f. Display your name in lower case letters (using dual).
g. Display today’s date.

13. Create your own tables Supp_(Roll No), Item_(Roll No), Ord_Mas_(Roll No) & Ord_Det_(Roll No)
with the same structure and data as Supp, Item, Ord_Mas, Ord_Det tables of the SCOTT user.
a. Display unique items from Ord_Det_(Roll No) table.
b. Write a SQL query that selects all Order along with Supplier Name.
c. Write a SQL query that selects all Orders along with Item Name.
d. Find orders with ‘Cabinet’ as an Item.
e. Display the names of items ordered in the order no. 30001.
f. Display this string “hello” in capital letters.
g. Find the square root of 361.

14. Create your own tables Supp_(Roll No), Item_(Roll No), Ord_Mas_(Roll No) & Ord_Det_(Roll No)
with the same structure and data as Supp, Item, Ord_Mas, Ord_Det tables of the SCOTT user.
a. Find Orders with ‘Sysquest’ as a Supplier.
b. Write a SQL query that selects total price for each item based on qty on stock.
c. Display O_No, I_No, Qty, I_Price, and Total Price.
d. Display O_No, O_Date, I_No, I_Name, Qty, I_Price and Total Price.
e. Find number of orders taken by each supplier.
f. Make initial letters of this string “hello world” capital letter.
g. Display today’s date in the following formats: 30-November-2017.
15. Create your own tables Supp_(Roll No), Item_(Roll No), Ord_Mas_(Roll No) & Ord_Det_(Roll No)
with the same structure and data as Supp, Item, Ord_Mas, Ord_Det tables of the SCOTT user.
a. Display item information with appropriate column aliases.
b. Find all suppliers who are from ‘WB’.
c. Find all orders in which order dates are between ‘01.01.2008’ and ‘31.12.2008’.
d. Display unique items from Ord_Det_(Roll No) table.
e. Write a SQL query that selects all Order along with Supplier Name.
f. Write a SQL query that selects total price for each item based on qty on stock.
g. Display today’s date in the following formats: 30- November – 2017.
h. Find the length of this string “Aliah University”.

S-ar putea să vă placă și