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

MSC BA OBA-1

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

MSC BA OBA-1

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Create a database by name “EMPLOYEE” with the following tables

Table Name: EMP


Empno Primary Key
FName Not Null
LName Not Null
Gender M or F
City
State
DOB
HireDate System Date

Table Name: Dept


DeptId Primary Key and Auto increment
DepName HR, Sales, Finance, Marketing, Purchase
Table Name: SALARIES
SlNo Primary Key
Empno FK to Emp Table
DeptId FK to Dept Table
Basic Above 5000 and below 50,000
DA Amount
HRA Amount
Deduction Amount
SalDate
Using DDL commands make the modifications as below:

1. Insert a new column to emp table by name country before DOB column
2. Give a constraint to city column which should contain the cities
Manipal/Mangalore/kochi/Thrissur/pune/Nagpur/Madurai
3. Change the size of Lname column to 10
4. Give constraint to DA column that it should be above 1000 only
5. Add auto increment to deptid which should start from 101
6. Change the column name to DName from Depname in dept table (Delete the constraint first
and then add back the constraint)
7. Add Desig column to the table (Clerk,FManager,SManager,Director,Attender)
8. Change the table name from Salaries to Salary
9. Set the Saldate column as default date
Insert records to all three tables as in page2
10. display the records where employees are from Mangalore or Manipal
11. Write a query to display female employees from state Karnataka or kerala
12. Display employee id, deptid and basic where basic is above 10000 and HRA is below 6000
13. Count the total number of records in salary table
14. Display the records where name starts with N and ends with a
15. Display the rowid 4,5,and 6 from emp table
16. Display the records from salary table by sorting basic column in descending order
Insert following records to tables

SlNo Empid deptid Basic Da Hra ded Desig


1 1001 `201 5000 1100 800 200 Clerk
2 1002 202 10000 1500 2200 500 SManager
3 1003 203 50000 2200 5000 1000 Director
4 1001 203 6000 1100 800 200 Clerk
5 1004 201 5000 1100 500 250 Attender
6 1004 201 5000 1200 500 250 Attender
7 1005 202 5000 1200 600 300 attender
8 1003 203 50000 2400 3000 500 Director
9 1004 202 7000 1100 500 250 Attender
10 1002 204 15000 1800 2200 500 FManager

Emp

EMP NO FNAME LNAME GENDER CITY STATE Dob


1001 Nisha Nayak F Mangalore Karnataka
1002 Neha Kamath F Manipal Karnataka
1003 Smitha Rai F Pune Maharastra
1004 Sushath Pai M Kochi Kerala
1005 Naresh Prabhu M Manipal Kerala

DEPT TABLE

finance
HR
Sales
Marketing
Purchase

You might also like