Professional Documents
Culture Documents
Table 2: Employee_master
Field Name Data Type Size Constraint
Employee_no Varchar2 6 Start with ‘e’
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/ start with ‘v’
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/ start with ‘m’
Material_desc Varchar2 25
Unit_price Number 6,2
Unit_ measure Varchar2 6
Stock number 3
Table 4: Order_master
V Use of Primary Key & Modify the structure of the employee_master table to have
foreign key Through primary key constraint on the filed employee_no.
Alter
Use of BETWEEN, IN, Q. Write a query to select the vendor id, name and phone no. of
LIKE,NOT IN through vendor who lives in the state of u.p.
where clause in select
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
-------------
Q. Write a query to select the vendor id, name and state of the
vendor whose assress2 field has a ‘.’ Contained in it.
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.
INFORMATION
----------------------
Vendor with id as v1001 lives in the state of uttar
Pradesh.
VII
Use of Joins: Q. Write a query to display the name, designation, department
name and location who does not work in the Kanpur office.