0% found this document useful (0 votes)
34 views

DBMS Practical List

The document provides details of tables to be created in a database including field names, data types, sizes and constraints. It also provides example problems involving queries on the tables using operators, functions and joins.

Uploaded by

Utkarsh Miglani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

DBMS Practical List

The document provides details of tables to be created in a database including field names, data types, sizes and constraints. It also provides example problems involving queries on the tables using operators, functions and joins.

Uploaded by

Utkarsh Miglani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

Data Base Management System Lab

The Final List given below:

Write the queries to create following tables


Table 1: Dept_master

Field Name Data type Size Constraint


Dept_no Varchar2 5 Primary key
Department_Name Varchar2 25
Department_Location Varchar2 30

Table 2: Employee_master

Field Name Data Type Size Constraint


Employee_no Varchar2 6 Primary key
Employee_name Varchar2 30
Address1 Varchar2 30
Address2 Varchar2 30
DateofBirth Date
Basic Number 6,2
Commission Number 6,2
Dept_no Varchar2 5 Depentdent on dept_no of dept_master
Designation Varchar2 6 Default ‘mstaff’ values if any can be any of
‘cman’, ’vp’, ’mgr’, ‘slman’ and ‘mstaff’

Table 3: Vendor_master

Field Name Data type Size Constraint


Vendor_id Varchar2 6 Primary key
Vendor_name Varchar2 25
Address1 Varchar2 25
Address2 Varchar2 25
City Varchar2 20
State Varchar2 15
Pincode Number 6
Phone number 10

Table 4: Material_master
Field Name Data type Size Constraint
Material_id Varchar2 6 Primary key
Material_desc Varchar2 25
Unit_price Number 6,2
Unit_measure Varchar2 6
Stock number 3

Table 4: Order_master

Field Name Data type Size Constraint


Vendor_id Varchar2 6 Dependent on vendor_id of vendor_master
Material_id Varchar2 6 Dependent on material_id of material_master
Quantity_ordered number 4 Greater than zero
Date_ordered Date Default system date
Order_id Varchar2 6
Sell_price number 6,2 Greater than zero
Employee_no Varchar2 6
Delivery_status Char 1 Default ‘p’ can have value ‘f’ or ‘p’
Qty_delivered number 4 Less than quantity_ordered and greater than zero

Unit Topics Identified Suggested Problems

II Use of Primary Key & Modify the structure of the employee_master table to have
foreign key Through primary key constraint on the field employee_no.
Alter

Q. Modify the structure of order_master table to have foreign


key constraint on the field employee_no.
Use of BETWEEN, IN, Q. Write a query to select the vendor id, name and phone o. of
LIKE,NOT IN through vendor who lives in the state of u.p.
where clause in select

Q. Write a query to select the name and address of vendor


whose name contain the letter ‘a’.

Q. Write a query to count the no. of vendors who fall in the state
of “uttar pradesh” If the no. of vendors in the state of uttar
pradesh are 3, the result should be as :

RESULT

-------------

No. of vendors in the state of uttar pradesh is 5

Q. Write a query to select the vendor id, name and state of the
vendor whose address2 field has a ‘.’ Contained in it.

Q. Write a query to list the details of vendors who does not


belong to the state of “uttar Pradesh” and “rajasthan”

Q. Write a query to list the material id, its description and stock
available for those whose unit price falls above 600 but less than
900.

Q. Write a query to display the information of a material whose


unit price is either 450.25 or 500 or 700 or 900.

Q. Write a query to display the information about the material


value in the stock is less than 5.

Use of Update Command Q. Write a query to change the address1 of vendor to “186,
circular no. 2” whose vendor id is v1001.

Q. Modify the date of birth to 23-aug-67 where employee id is


e10126.

Q. Write a query to inform you about the vendor(s) in the


following form :- (e.g.)

INFORMATION

----------------------

Vendor with id as v1001 lives in the state of uttar


Pradesh.

Use of And operator in


Select : Q. Write a query to display the names of all employees whose
commission is more than 10% of their basic salary and falls in
the category of salesman.

Use of Sub Query:


Q. Write a query to select the employee no. and name of those
employees who earn salary more than the average salary of all
the employees working in the organization.

Use of function
MAX ,MIN,AVG: Q. Write a query to select the minimum, maximum and average
salary of the employees working in the organization. The
headings should be smi, smx and sav respectively.

Use of Group by and


Q. Write a query to display the employee id, name and
Order By
department no. of all employees who are either working as
salesman or miscellaneous staff. The grouping should be
department wise. Within the department, it should have all
salesman together and all miscellaneous staff together.

Q. Write a query to inform you about the no. of employees


working for each department.

Q. Write a query to select the name, department name and


location of employee who are designated as manager.

Use of Joins:

Q. Write a query to display the name, designation, department


name and location who does not work in the Kanpur office.

Q. Write a query to list the name and id of all employees in


alphabetical order of their name.

Q. Write a query to select the name and date of birth of those


employees who are born before February 7, 1976.

Q. Write a query to select the name and department of those


employees who have age between 30 and 40 years.

Q. Write a query to select the name and basic salary of


employees who have a letter ‘e’ or‘s’ in their names. Further,
modify the query list for those who does not contain ‘m’ in their
names.

Q. Write a query to list the id, name and department no. of


employees who are born in the month of February.

You might also like