2024 Bca Dbms Lab

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

BCA DBMS LAB

1. The ACTOR database has a table with the following attributes. The primary keys
are underlined.
EMP (ACTno: int, name: string, dob: date, PhNo: int)
a) Create the above table.
b) Display table Structure.
c) Enter five tuples into the table.
d) Display all the tuples in ACT table.

2. Perform the following: Consider Dept table: (DEPTNO, DNAME, LOC)


 Perform the following:
 Altering a Table, Dropping/Truncating/Renaming Tables,
 Rename the table dept as department
 Add a new column PINCODE with not null constraints to the existing table DEPT
 Rename the column DNAME to DEPT_NAME in dept table Change the data type
of column loc as CHAR with size 10
 Delete table

3. Company database has a table with the following attributes.


company (emp_id: integer, emp_name: string, gender: character)
dept (dept_id: integer, dept_name: string)
pay (emp_id: integer, dept_id: integer, salary: integer)
Perform the following:
• Create company database
• Viewing all databases
• Viewing all Tables in a Database,
• Creating Tables (specifying the primary keys and the foreign keys)
• Saving (Commit) and Undoing (rollback)

4. Consider the following STUDENT (Registerno, Name, Address, Phone, Gender)


a. Inserting/Updating/Deleting Records in a Table, Saving (Commit) and
Undoing (rollback)
b. Backing up / Restoring a Database.

5. For a given set and perform the following Aggregate functions.

EMPN EMP_NAME DEPT SALARY DOJ BRANCH


E101 AMIT PRODUCTION 45000 12-MAR BANGLORE
00
E102 AMIT HR 70000 03-JUL-02 BANGLORE
E103 SUNITA MANAGEMENT 120000 11-JAN - MYSORE
02
E105 SUNITA IT 67000 01-AUG- MYSORE
01
E106 MAHESH CIVIL 145000 20-SEP- MUMBAI
03

I. Retrieve number of employees


II. Retrieve distinct number of
employees
BCA DBMS LAB

6. Consider the Company database with following Schema

 EMPLOYEE (FNAME, MINIT, LNAME, SSN, BDATE, ADDRESS, SEX, SALARY,


SUPERSSN, DNO)
 DEPARTMENT (DNAME, DNUMBER, MGRSSN, MSRSTARTDATE)
 DEPT_LOCATIONS (DNUMBER, DLOCATION)
 PROJECT (PNAME, PNUMBER, PLOCATION, DNUM) WORKS_ON (ESSN,
PNO<HOURS)
 DEPENDENT (ESSN, DEPENDENT NAME, SEX, BDATE, RELATIONSHIP)

1. Find the sum of the salaries of all employees of the 'Accounts'


department, as well as the maximum salary, the minimum salary,
and the average salary in this department.
2. For each project, retrieve the project number, the project
name, and the number of employees who work on that project
(use GROUP BY)
3. Retrieve the name of employees who born in the year 1990's
4. Retrieve the name of each employee Controlled by a particular
Department.

7. Consider the Company database with following


Schema
 EMPLOYEE (FNAME, MINIT, LNAME, SSN, BDATE, ADDRESS, SEX, SALARY,
SUPERSSN, DNO)
 DEPARTMENT (DNAME, DNUMBER, MGRSSN, MSRSTARTDATE)
 DEPT_LOCATIONS (DNUMBER, DLOCATION)
 PROJECT (PNAME, PNUMBER, PLOCATION, DNUM) WORKS_ON (ESSN,
PNO<HOURS)
 DEPENDENT (ESSN, DEPENDENT NAME, SEX, BDATE, RELATIONSHIP)
Questions
1. Retrieve the name of each dept and number of employees working in
each Department.
2. Retrieve the department number and number of employees who
are making salary more than 40000.
3. Retrieve the project number and the number of employees who
work on that project.

You might also like