Professional Documents
Culture Documents
Dbms
Dbms
Practice DDL and DML commands on a basic table without integrity constraints.
Consider the following schema of:
employee(EMPNO: number(10),
ENAME: varchar2(20),
JOB: varchar2(20),
MGR: number(20),
HIREDATE: date,
SAL: number(20),
COMM:number(10),
DEPTNO: int)
1) Write a SQL query to create a relation employee.
2) Write a SQL query to add new column address to the existing schema.
FINAL TABLE:
11) Display all the details of employees whose commission is more than their salary.
12) List the empno,ename, daily sal of all employees in asc older of annual sal.
VNR VJIET Name of the Experiment: ____________
14) List the employees in the asc order of the dept no and desc of jobs.
16) List the employees who are either clerks or developers in asc order.
18) List the employees who are working for the deptno 10 or 20.
19) List the employees who are joined in the year 1950.
VNR VJIET Name of the Experiment: ____________
20)List the employee names those are having 6 characters in their names.
21) List the employee names those are starting with ‘J___’.
22) List the employee names those are having 6 characters and 4th character must R.
24) lList the employees those are having sal 4digit number ending with 0.
25) List the employee names those are having a a character set ‘oo’ together.
Practice DDL and DML commands on a Relational Database, specifying the Integrity
constraints. (Primary Key, Foreign Key, CHECK, NOT NULL) .
Consider the following schema:
emp(eid:int Primary key,
ename:varchar2,
age:int,
salary: number)
works(eid:int foreign key
did:int foreign key
time: varchar2)
dept(did:int Primary key,
dname:varchar2,
budget:number,
manager_id:int)
1. Write a sql statement required to create the above relations and aplly the appropriate
versions of all primary and foreign key constraints.
4. Apply CHECK constraint on salary and salary should be greater than 1000.
5. Apply CHECK constraint on budget and budget should in between 1000 and 50000.
VNR VJIET Name of the Experiment: ____________
Joins:
Apply joins on schema:
class(class_id,class_name)
class_info(id,address)
Create table class
1) INNER JOIN
2) NATURAL JOIN
SETS:
Create Table person and person1
1) UNION
2) UNION ALL
VNR VJIET Name of the Experiment: ____________
3) INTERSECT
4) MINUS