Assignment
Assignment
TECHNOLOGY ,GHAZIABAD
3 To implement the
restrictions/constraints on table.
Assignment No.1
i) client_master
columnname datatype size client_no
varchar2 6 name varchar2 20
address1 varchar2 30 address2
varchar2 30 city varchar2 15 state
varchar2 15 pincode number 6
bal_due number 10,2
ii) Product_master
Q3:- On the basis of above two tables answer the following Queries:
i) Find out the names of all the clients.
ii) Retrieve the list of names and cities of all the clients.
iii) List the various products available from the product_master table. iv)
List all the clients who are located in Bombay.
v) Display the information for client no 0001 and 0002.
vi) Find the products with description as ‘1.44 drive’ and ‘1.22 Drive’. vii)
Find all the products whose sell price is greater than 5000.
viii) Find the list of all clients who stay in city ‘Bombay’ or city ‘Delhi’ or ‘Madras’. ix)
Find the product whose selling price is greater than 2000 and less than or equal to 5000.
x) List the name, city and state of clients not in the state of ‘Maharashtra’.
OUTPUT
1 i)
ii)
2 i)
ii)
3 i)
ii)
iii)
iv)
v)
vi)
vii)
viii)
ix)
x)
Assignment No.2
Question.1 Using the table client master and product master answer the following Queries.
OUTPUT:
i)
ii)
iii)
iv)
v)
vi)
Vii)
viii)
ix)
x)
xi)
xii)
xiii)
Assignment No.3
Syntax :
Create table table name
(columnname datatype (size) references another table name);
Syntax :
Create table name (columnname datatype
(size)…. primary key
(columnname);
foreign key (columnname)references table name);
Check Integrity Constraints: Use the check constraints when you need to enforce intergrity
rules that can be evaluated based on a logical expression following are a few examples of
appropriate check constraints.
● A check constraints name column of the coient_master so that the name is entered in upper case.
● A check constraint on the client_no column of the client _master so that no client_no value starts
with ‘c’
Syntax:
Create table tablename
(columnname datatype (size) CONSTRAINT
constraintname) Check (expression));
i. Sales_master
Pincode Number 6
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, cannot be 0
Remarks Varchar2 30
ii. Sales_order
I. Sales_order_details
Column Datatype Size Attributes
Insert the following data into their respective tables using insert statement:
(i)
Data for sales_order_details table:
OUTPUT:
Creation i)
ii)
iii)
Insertion i)
ii) iii)
Assignment No.4
Question 1. Create the following tables: Challan_Header
Column name data type size Attributes Challan_no
varchar2 6 Primary key
s_order_no varchar2 6 Foreign key references s_order_no of
sales_order table
challan_date date not null
billed_yn char
Q2. Insert the following values into the challan header and challan_details tables:
OUTPUT
1
i)
ii)
2
i)
ii)
3
i)
ii)
iii)
iv)
v)
Assignment No.5
A. Consider the following schema for a Library Database:
1. Retrieve details of all books in the library – id, title, name of publisher, authors, number of copies in
each branch, etc.
2. Get the particulars of borrowers who have borrowed more than 3 books, but from Jan 2017 to Jun
2017.
3. Delete a book in BOOK table. Update the contents of other tables to reflect this data manipulation
operation.
4. 4. Partition the BOOK table based on year of publication. Demonstrate its working with a simple
query.
5. Create a view of all books and its number of copies that are currently available in the Library.
OUTPUT
1 i)
ii)
iii)
iv)
v)
Assignment NO. 6
Answer the following Queries:
QUERIES -
1. Find out the product which has been sold to ‘Ivan Sayross.’ 2. Find
out the product and their quantities that will have do delivered.
3. Find the product_no and description of moving products.
4. Find out the names of clients who have purchased ‘CD DRIVE’
5. List the product_no and s_order_no of customers haaving qty ordered less than 5 from the order
details table for the product “1.44 floppies”.
6. Find the products and their quantities for the orders placed by ‘Vandan Saitwal ’ and “Ivan
Bayross”.
7. Find the products and their quantities for the orders placed by client_no “ C00001” and
“C00002”
8. Find the order No,, Client No and salesman No. where a client has been received by more than
one salesman.
9. Display the s_order_date in the format “dd-mm-yy” e.g. “12- feb-96”
10. Find the date , 15 days after date.
OUTPUT
Assignment No.7
Q1.- Print the description and total quantity sold for each product.
Q3.- Calculate the average quantity sold for each client that has a maximum order value of 15000.
Q4.- Find out the products which has been sold to Ivan.
Q6.- Find the products and their quantities for the orders placed by ‘Vandana’ and ‘Ivan’.
Q8.- Select product_no, product description and qty ordered for each product.
Q9.- Display the order number and day on which clients placed their order.
Q10.- Display the month and Date when the order must be delivered.
OUTPUT
Assignment NO.8
Objective: Answer the following Queries:
QUERIES:
OUTPUT