Beruflich Dokumente
Kultur Dokumente
DATE: 21.06.2016
DATA DEFINITION LANGUAGE (DDL)
AIM: Create a database to implement DDL basic commands using the Employee database as
given below.
1.
not null,
2.
3.
4.
5.
6.
EXPERIMENT NO: 2
DATE: 30.06.2016
DATA MANIPULATION LANGUAGE (DML)
AIM: Create a database in order to implement basic DML commands using the Employee
database as given below.
QUERIES:
1. INSERT INTO DEPARTMENT VALUES('DEP-03', 'ACCOUNTING', 1213143);
2. UPDATE EMPLOYEE SET CONTACT_NO='0115', CITY='BANGALORE' WHERE
EMP_ID='EMP-06';
10
EXPERIMENT NO: 3
DATE: 05.07.2016
JOINS
AIM: Create a Company and a department Database and solve the various join operations.
Company (id, name, age, address, salary, join date)
Department (id, dept, emp id)
SYNTAX:
SELECT ATTRIBUTE1, ATTRIBUTE2 ..., FROM TABLE 1 CROSS JOIN TABLE2;
SELECT ATTRIBUTE1, ATTRIBUTE2 ..., FROM TABLE 1 INNER JOIN/LEFT OUTER
JOIN/RIGHT OUTER JOIN/ FULL OUTER JOIN TABLE2 ON CONDITION;
QUERIES:
CREATE AND INSERT VALUES INTO THE COMPANY AND DEPARTMENT TABLE
Create table department2 (id int, dept varchar (20), emp_id int);
Insert into department2 values (1,'t billing', 1);
Insert into department2 values (2,'engineering', 2);
Insert into department2 values (3,'finance', 41);
Select *from department2;
Create table company (id int, name varchar(10), age int, address varchar(30), salary
numeric(8,2), join_date date );
Insert into company values (1,'paul', 32,'California', 20000,'2001-07-13');
Insert into company values (3,'allen', 23,'Norway', 20000);
Insert into company values (4,'david', 25,'Richmond', 65000,'2010-10-25');
Insert into company values (5,'mark', 27,'Texas', 35000,'2015-11-02');
Insert into company values (2,'teddy', 25,'Los vegas', null,'2013-09-01');
Select *from company;
1.
CROSS JOIN
Select emp_id, name, dept from company cross join department2;
2.
INNER JOIN
Select emp_id, name, dept from company inner join department2 on
company.id=department2.emp_id;
3.
4.
5.
EXPERIMENT NO: 4
DATE: 21.07.2016
VIEWS
AIM:
Consider the following schemas:
Employee (empID, fName, lName, address, DOB, deptNo)
Department (deptNo, deptName, mgrID)]
Project (projNo, projName, deptNo)
WorksOn (empID, projNo, hoursWorked)
Questions
1. Create tables for above listed schemas and corresponding Simple Views.
2. Insert values into each of the table in given order using views only.
3. Perform Update and Delete operation on WorksOn table using the view.
4. Create a view and perform Select Operation for all given below conditions using created
views only.
a. List name and address of all employees who are Managers.
b. Find out how many employees are managed by Kapil
c. For each project on which more than two employees worked, list the project
number, project name and number of employees worked on that project.
SYNTAX:
CREATE VIEW VIEW_NAME AS SELECT ATTRIBUTE1, ATTRIBUTE 2 FROM
TABLE_NAME;
QUERIES:
1. CREATE THE TABLES AND THEIR SIMPLE VIEWS
create table employee(
empid int primary key,
fname varchar(30),
Department Of Computer Science And Engineering