US03CBCA04 - Practical
US03CBCA04 - Practical
BCA
Course : US03CBCA04
(Practical)
Page 1 of 9
b. Data for movie table:
mv_no title type star price
1 Bloody Vengeance action Jackie Chan 180.95
2 The firm thriller Tom Cruise 200.00
3 Pretty woman romantic Richarge Gere 150.00
4 Home alone comedy Macaulay Culkin 150.55
5 The fugitive thriller Harrison Ford 200.00
6 Coma suspence Michael Douglas 100.00
7 Dracula horror Gray Oldman 150.00
8 Quick change comedy Bill Murray 100.00
9 Gone with the wind drama Clarke Gable 200.00
10 Carry on doctor comedy Leslie Phillips 100.00
c . Data for invoice table :
Page 2 of 9
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 09-DEC-82 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 12-JAN-83 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
TABLE NAME: SALGRADE
Name Null? Type
------------------------------- -------- ----
GRADE NOT NULL NUMBER(1)
LOSAL NOT NULL NUMBER(4)
HISAL NOT NULL NUMBER(4)
Page 3 of 9
Table Name : Salesman_master
Name Type Attributes
-------------------------- -------------
SALESMAN_NO VARCHAR2(6) Primary Key / first letter must start With ‘S’
SALESMAN_NAME VARCHAR2(20) Not Null
ADDRESS1 VARCHAR2(30) Not Null
ADDRESS2 VARCHAR2(30)
CITY VARCHAR2(20)
PINCODE VARCHAR2(6)
STATE VARCHAR2(20)
SAL_AMT NUMBER(8,2) Not Null, cannot be 0
TGT_TO_GET NUMBER(6,2) Not Null,cannot be 0
YTD_SALES NUMBER(6,2) Not Null
REMARKS VARCHAR2(60)
Page 4 of 9
Table Name :Challan_Details
Name Type Attributes
------------- ------- ------------
CHALLAN_NO VARCHAR2(6) Primary Key/Foreign Key references
Challan_no of challan_header table.
PRODUCT_NO VARCHAR2(6) Primary Key / Foreign Key references
Product_no of product_master table
QTY_DISP NUMBER(4,2) Not Null
Insert the following data into their respective tables using the SQL insert statement :
Data for client_master table
Sales Salesman Address1 Address2 City Pincode State Salea Tgt_To_ Ytd Remarks
man_No _Name mt Get sales
S00001 Kiran A/14 Worli Bombay 400002 MAH 3000 100 50 Good
S00002 Manish 65 Nariman Bombay 400001 MAH 3000 200 100 Good
S00003 Ravi P-7 Bandra Bombay 400032 MAH 3000 200 100 Good
S00004 Ashish A/5 Juhu Bombay 400044 MAH 3500 200 150 Good
Page 5 of 9
Data for sales_order_details table
Page 6 of 9
16. Find the products whose cost_price is less than 1500.
17. List the products in sorted order of their description.
18. Calculate the square root of the price of each product.
19. Divide the cost of product ‘540 HDD’ by difference between its price and 100.
20. List the names,city and state of clients not in the state of ‘Maharashtra’.
21. List the product_no,description,sell_price of products whose description begiin with
letter ‘M’.
22. List all the orders that were canceled in the month of March.
Assignment 3 (Set Functions and Concatenation)
30. Print the description and total qty sold for each product.
31. Find the value of each product sold.
32. Calculate the average qty sold for each client that has a maximum order value of
15000.00
33. Find out the total sales amount receivable for the month of jan.It will be the sum total
of all the billed orders for the month.
34. Print the information of product_master,order_detail table in the following format for
all the records :- {description} worth Rs. {total sales for the product} was sold.
35. Print the information of product_master,order_detail table in the following format for
all the records :-
{description} worth Rs. {total sales for the product} was ordered in the month of
{s_order_date in month format}
36. Find out the products which has been sold to ‘Ivan Bayross’.
37. Find out the products and their quantities that will have to delivered in the current
month.
38. Find the product_no and description of moving products.
39. Find the names of clients who have purchased ‘CD Drive’.
40. List the product_no and s_order_no of customers having qty_ordered less than 5
from the order_details Table for the product ‘1.44 Floppies’.
41. Find the products and their quantities for the orders placed by ‘Vandana Saitwal’ and
‘Ivan Bayross’.
42. Find the products and their quantities for the orders placed by client_no ‘C00001’ and
‘C00002’.
Page 7 of 9
Assignment 6 (Nested Queries)
48. Display the order number and day on which clients placed their order.
49. Display the month (in alphabets) and date when the order must be delivered.
50. Display the s_order_date in the format ‘dd-month-yy’ e.g. 12-February-98.
51. Find the date,15 days after today’s date.
52. Find the number of days elapsed between today’s date and the delivery date of the
orders placed by the clients.
Table structure:
dept (dept_id number(5) primary key, emp(emp_id number(3) primary key,
dept_name varchar2(20) not null) emp_name varchar2(20) not null,
emp_sal number(8,2),
dept_id number(5) references dept)
1 WAQ to create a view having name “emp_vw” which contains emp_id, emp_name and salary
from emp table.
2 WAQ to add new records in “emp” table using “emp_vw” view.
3 WAQ to update salary of JOHN from 2000 to 5000.
4 WAQ to create a read only view having name “emp_ro_vw” which contains emp_id,
emp_name and salary.
5 WAQ to view having name which contains emp_name, emp_sal and dept_name from dept
and emp table.
Page 8 of 9
Assignment 10 (sequence)
1 Create sequence “seq1to10” which is start with 1 and ends with 10.
2 Create sequence “seq_even” which is generates with even numbers between
100 and 500.
3 Create sequence “seq_rev” in a way that produce Z-A repetitive.
4 Create sequence “seq_div3”, it generates the number which is divisible by 3 and
numbers are between 3 and 23.
5 Create sequence “seq_5” which is generates the numbers between 5 and 250, it
start with 5 increment by 5, end with 250, cache value 5 and also the numbers are
in order.
Assignment 11 (synonym)
Page 9 of 9