100% found this document useful (1 vote)
377 views16 pages

19BCE2651 (Cycle Sheet 1)

The document describes tables and queries for a company database including tables for employees, departments, dependents, projects, and employee assignments to projects. It lists columns for each table and specifies primary keys. It provides sample data insertion and integrity constraint checks. It then lists several queries to retrieve data from the tables such as employee details, dependent names and dates of birth, employee names by criteria, project names by location, and more. It also describes altering tables to add foreign keys and constraints and modifying data. Finally, it lists queries using SQL functions to calculate ages, years, months of births, format output, and manipulate strings.

Uploaded by

namus nadnat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
377 views16 pages

19BCE2651 (Cycle Sheet 1)

The document describes tables and queries for a company database including tables for employees, departments, dependents, projects, and employee assignments to projects. It lists columns for each table and specifies primary keys. It provides sample data insertion and integrity constraint checks. It then lists several queries to retrieve data from the tables such as employee details, dependent names and dates of birth, employee names by criteria, project names by location, and more. It also describes altering tables to add foreign keys and constraints and modifying data. Finally, it lists queries using SQL functions to calculate ages, years, months of births, format output, and manipulate strings.

Uploaded by

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

NAME: SUMAN TANDAN

REG.NO: 19BCE2651

DATABASE MANAGEMENT SYSTEM


DBMS-2004

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

Create the following tables


Company Database
Employee (SSN, Name (fname, Minit, Lname), Sex, Address,salary, DOB, Department, designation,
SupervisorSSN)
Department (Number, Name, ManagerSSN, Manager_DOB, Location)
Dependent (Name, DOB, Sex, Relationship, Employee SSN)
Project (Number, Name, Location, Controlling Department, Budget)
Works_on (SSN, Project Num, Hours)
a. Make the underlined columns as primary key.
b. Insert at least 5 rows to each table.
(Apply Interactive insertion. Check Entity Integrity Constraint and key Constraint.)
QUERIES:

1. The employee details.

2. Name and DOB of dependent table.

3. Employee names whose name start with “S”.

4. Employee names who work for department no 5.


5. Dependent names who are females and related to Employee no 15678.

6. Project names which are in a particular location.

8. Department details which has a manager.


10. Employees who were born during 1970s.

11. Employee names who salary is in the range 12000 to 30000.


Alter the tables to
1. Add required foreign keys.

2. Insert values to see the referential integrity constraints.

3. Make name of Project as Unique and sex of employee as not null.


5. Increase the size of project name.

Queries on SQL * PLUS functions.


1. Find the age of an Employee.

2. Print the year 12 years later than an employee’s birth year.

3. Print the month of births of all employees.


4. Print the Project names in Upper case

5. Print department names with left padded stars.

6. Print the first five characters of employee first names.

7. Print the length of longest department name.

9. Replace the a’s present in employee names with ‘e’.

You might also like