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

NAUSHAHRO FEROZE CAMPUS

SCHOOL OF INFORMATION TECHNOLOGY

PRACTICAL WORKBOOK

Introduction to Database

Name of Student: - Muhammad Faisal


Roll Number: -20-BsIt-11
Name of Instructor: - Sir Noor Hassan

Practical no 1

How to download and Install Oracle 11g

p a g e 1 | 16
Step 1: -First we go into google and search Oracle 11g download for windows 11 or
any windows want.

Link: -(https://www.oracle.com/database/technologies/oracle-database-software-
downloads.html)

Step 2: -Now here you have to select your system bit and version and as you can I
have selected my version (64-bit).in last click on zip

Step 3: -Here first you have to accept the Oracle License Agreement and click on
Download windows_x66_193000_do_home.zip then your download will start
Step 4: -Here you can the download has been started. When it complete then click on
oracle exe file

Step 5: -Now here your installation is started click Next

Step 6: -Accept the terms in the license agreement and in last click on Next

Step 7: -In this


step here you
have to give location to your file click on Browse and in which drive you wants to
install your file then press on Next icon

Step 8: -Now in this step click on Yes and go to the next step
Step 9: -Now here click on install then your installation will start.

Step 10: -Here you have you assign your password that’s helps you in while using
Oracle.

Step 11: -Here is you installation is Finish

Practical no 2
How to Retrieve data from EMP and Dept in Table
Step 1: -Here I have used Query to retrieve data from Emp. The * is used to retrieve
all data from tables

Query: Select *
FROM EMP.

Step 2: -Here I have also use Query to retrieve data from Dept. The * is used to
retrieve all data from tables
Query: Select *
FROM DEPT.
Practical no 3

How to use Arithmetic Operators to Retrieve Data from EMP and


Dept in Table

Step 1: - Here I have used Addition Query to add + 500 in salary data from Emp.

Query: Select sal, sal +500


FROM EMP.
Step 2: - Here I have used Subtract Query to – 500 in salary data from Emp.

Query: Select sal, sal -500


FROM EMP

Step 3: - Here I have used Multiplication Query to * 500 in salary data from Emp.

Query: Select sal, sal *500


FROM EMP
Step 3: - Here I have used Division Query to / 500 in salary data from Emp.

Query: Select sal, sal /500


FROM EMP

Practical No 4

How to Create a table with primary key

Step 1: -Now Here I hacan used Query to create a table with primary key

Query: CREATE TABLE BSIT20

Primary keys: - (STUDENT_ID CHAR (5), FATHER_NAME CHAR (10),


ADDRESS CHAR (12), CITY CHAR (18))
Practical No 5

How to alter table to add, modify and drop table

Step 1: - Now Here I have used Query, alter table to add table.

Query: CREATE TABLE BSIT20

(STUDENT_ID CHAR (5), FATHER_NAME CHAR (10), ADDRESS


CHAR (12), CITY CHAR (18))
This is altered table: ALTER TABLE BSIT20

Here I have added job_id: ADD (JOB_ID VARCHAR (7));

This is for displaying table: DESCRIBE BSIT20

Step 2: -Here I have also used Query, alter table to modify table.

Query: CREATE TABLE BSIT20

(STUDENT_ID CHAR (5), FATHER_NAME CHAR (10), ADDRESS


CHAR (12), CITY CHAR (18));

This is altered table: ALTER TABLE BSIT20


Here I have to modify varchar (datatype): MODIFY (FATHER_NAME
VARCHAR (15));

This is for displaying table: DESCRIBE BSIT20


Step 3: -Here I have also used Query, alter table to drop table.
Query: CREATE TABLE BSIT20

(STUDENT_ID CHAR (5), FATHER_NAME CHAR (10), ADDRESS


CHAR (12), CITY CHAR (18));

This is altered table: ALTER TABLE BSIT20


This is for delete and drop column: DROP ( FATHER_NAME);
This is for displaying table: DESCRIBE BSIT20

Practical No 6

How to use Data manipulating language (DML) to insert, update and delete data

Step 1: -Here I have used Query to insert data.

Query: CREATE TABLE BSIT2K


Primary keys with datatypes: (STUDENT_ID CHAR (15), STUDENT_NAME
VARCHAR (11), FATHER_NAME (10) , ADDRESS CHAR (12), CITY CHAR (7))

INSERT INTO BSIT2K (STUDENT_ID, STUDENT_NAME, FATHER_NAME,


ADDRESS, CITY)

Here I am inserting my detail into column values: VALUES ('20BSIT09',


'IMRAN', 'GUL HASSAN' , 'LUND CONOLY' , 'NFC')

This is for displaying the data you insert: SELECT * FROM BSIT2K

Step 2: -Here I have also used Query to update data.

Query: CREATE TABLE BSIT2K

Primary keys with datatypes: (STUDENT_ID CHAR (15), STUDENT_NAME


VARCHAR (11), FATHER_NAME (10) , ADDRESS CHAR (12), CITY CHAR (7))
Updating: UPDATE BSIT2K

SET STUDENT_NAME = 'IMRAN ALI'

WHERE STUDENT_ID = '20BSIT09'

This is for displaying the data I have updated: SELECT * FROM BSIT2K

‘FAISAL’

‘20bsit11’

Step 3: -Here I have also used Query to update data.

Query: CREATE TABLE BSIT2K

(STUDENT_ID CHAR (5), FATHER_NAME CHAR (10), ADDRESS CHAR


(12), CITY CHAR (18))

Deleting: DELETE FROM BSIT2K


WHERE STUDENT_ID = '20BSIT09'

You might also like