0% found this document useful (0 votes)
39 views2 pages

DBMS Lab Excercices

1. The document describes creating DDL commands to define tables, alter tables by adding, deleting and modifying columns, and performing DML commands like insert, update and delete on the tables. 2. It provides the schema for an EMP table and describes performing single row insert, inserting multiple columns or rows, and update and delete operations. 3. The schema for an Emp table is defined and queries are listed to display table information, filter rows by dates, compare columns, and filter by department numbers. 4. The document describes creating a Student table, adding a column, modifying a column size, and dropping a column. It also describes inserting 5 records into the Student table. 5. The

Uploaded by

Kiran Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views2 pages

DBMS Lab Excercices

1. The document describes creating DDL commands to define tables, alter tables by adding, deleting and modifying columns, and performing DML commands like insert, update and delete on the tables. 2. It provides the schema for an EMP table and describes performing single row insert, inserting multiple columns or rows, and update and delete operations. 3. The schema for an Emp table is defined and queries are listed to display table information, filter rows by dates, compare columns, and filter by department numbers. 4. The document describes creating a Student table, adding a column, modifying a column size, and dropping a column. It also describes inserting 5 records into the Student table. 5. The

Uploaded by

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

1.

Creation of DDL Commands:


Using SQL CREATE the following schema of tables.
EMP(Empno number(5), Ename varchar2(20),Sal number(8,2), Designation
varchar2(20), Address varchar2(20))
DEPT(Deptno number(3), Dname varchar2(20), Location varchar2(25))
Using SQL Alter the EMP Table for the following:
To add a column as Hiredate with varchar2 (20) in EMP table.
To delete a column Address in EMP table.
To change the data type of a Hiredate column as Date in EMP table.

2. Create the following table and implement DML commands


EMP(Empno number(5),Ename varchar2(20),Sal number(8,2), Designation varchar2(20),
Address varchar2(20));
a. Single-row insert
b. Inserting one row, many columns at a time
c. Inserting many rows, all/some columns at a time.
d. Perform Update and Delete operations of the following statements.
i) Update the Address and Sal field whose empno is 101.
ii) Delete the record whose empno is 102.

3. Consider the following Schema:


Emp(Empno number(5),Ename varchar2(20),Job varchar2(20), MGR number(5),
Hiredate date, Sal Number(8,2),Commission number(5),Deptno number(5));
Write the following queries to the above schema:
i) Display the information of the Emp table.
ii) List the Emps who joined before 1981.
iii) Display all the details of the Emps whose commission is more than their Sal.
iv) List the Emp who are working for the Deptno 10 or 20.
v) List the Emps who are joined in the year 1990.
vi) List the Emps who are joined in the month of August 1990.
vii) List the Emps who does not belong to Deptno 20.
viii) List the Emps who joined before 1985.
ix) List the Emps whose name ends with alphabet H.
x) List the Emp names starting with S and ending with H
4. To create a Student Table with the attributes RollNo varchar2(10), Name
varchar2(10), Branch varchar2(5), Year date, Date of Birth date
Total_Marks number(5) where RollNo is Primary Key and Name must not be
NULL.
i) To add new column Semester varchar2 (10) into Student table.
ii) To modify the size of column Name varchar2(10) as varchar2 (20) in Student
table.
iii) To drop column Total_Marks in Student table.

To insert 5 records into a table named Student with the attributes RollNo,
Name, Branch, Year, Date of Birth and Total_Marks where RollNo is primary
key and Name must not be null.

5. To create a Persons Table with the attributes PID Number (5), Name
varchar2 (10), Address Varchar2(20), City Varchar2(10) where PID is
Primary Key and Name must not be NULL.

To Create a Orders Table with the attributes OID Number(5), Orderno


Number(10) , PID Number(5) where OID is Primary Key , PID is a Foreign
Key and Orderno must not be NULL.
Insert the data into Persons and Orders tables at least 10 records.
i) Update Persons table column Address as Tirupati whose PID is 201
ii) Update Persons table column Name as Mahesh whose PID is 203

You might also like