0% found this document useful (0 votes)
9 views5 pages

Exp 1

Uploaded by

cat3eow9503
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)
9 views5 pages

Exp 1

Uploaded by

cat3eow9503
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/ 5

LAB MANUAL

PART A
(PART A : TO BE REFFERED BY STUDENTS)

Experiment no: - 1

Experiment Name: - Introduction of Oracle & Basic SQL Statements

Aim: -Performing practical by using Basic SQL

Statements. Resource Required: - Oracle 9i - iSQLplus

Theory: -
 Main types of Database (DBMS):
1. Hierarchical
2. Network
3. Relational
4. Object relational
Relational Database Concept:
- It‟s basis for the relational database management system (RDBMS).
- The relational model consists of the following:
- Collection of objects or relations
- Set of operators to act on the relations
- Data integrity for accuracy and consistency.
- A relational database is a collection of relations or two-dimensional tables.
That is a relational database uses relations or two-dimensional tables to store
Information.
 Relational Database Properties:
- Can be accessed and modified by executing structured query language
(SQL) statements
- Contains a collection of tables with no physical pointers
- Uses a set of operators.

 SQL STATEMENTS:

Basic SELECT Statements:


 - SQL statements aren‟t case sensitive.
 - SQL statements can be on one or more lines.
 - Keywords can‟t be abbreviated across lines.
 - Clauses are usually placed on separate lines.
 - Indents are used to enhance readability.
SELECT – Retrieves data from the database.
Syntax:-
SELECT *| {[DISTINCT] column | expression [alias]
…} FROM table;

- SELECT identifies what columns


- FROM identifies which
table Example: -
1) SELECT *
FROM departments;
DEPT_ID DEPT_NAME MANAGER_ID LOCATION_ID
Administration
1 2 1

Shipping
2 2 1

IT5 1 1

Selecting all columns of the table.

2) SELECT dept_id, location_id


FROM departments;
DEPT-ID LOCATION_ID
10 1700
20 1400
Selecting specific columns.
3) Arithmetic Operators & Parentheses
SELECT last_name, salary, 12*(salary+100)
FROM employees;
LAST_NAME SALARY 12*(SALARY+100)
King 24000 269200
Kochhar 17000 205200
Fay 13000 73200
4) Defining column aliases
SELECT last_name AS name, salary*12 anuual_salary
FROM employees;
NAME ANNUAL_SALARY
King 228800
Kochhar 204000
De Haan 204000
5) Using Concatenation Operator
SELECT last_name || job_id AS “Employees”
FROM employees;
Employees
KingAD_PRES
KochharAD_VP
De HaanAD_VP
HunoldIT_PROG
6) Eliminating Duplicate Rows
SELECT DISTINCT
dept_id FROM employees;
DEPT_ID
10
20
30
7) Displaying Table Structure
DESCRIBE employees

Name Null? Type


EMPLOYEE_ID NOT NULL NUMBER(6)
FIRST_NAME VARCHAR(20)
LAST_NAME NOT NULL VARCHAR(25)
EMAIL NOT NULL VARCHAR(25)
PHONE_NUMBER VARCHAR(20)
HIRE_DATE NOT NULL DATE

Conclusion:
You should have learned how to write & execute SELECT statements.
PART B
(PART B: TO BE COMPLETED BY STUDENTS)

(Students must submit the soft copy as per following segments within two hours of the practical. The soft copy
must be uploaded on the Blackboard or emailed to the concerned lab in charge faculties at the end of the
practical in case the there is no Black board access available)

Roll. No. Name:


Class Batch:
Date of Experiment: Date of Submission:
Grade:
B.1: Read the given question carefully and write a SQL statement and check the output.
(Put the query and its output after each question.)

1. Show the structure of the DEPARTMENTS table. Select all data from the table.
2. Create a query to display the last name, job code, hire date, and employee number for each employee,
with employee number appearing first. Provide an alias for the columns.
3. Create a query to display unique job codes from the EMPLOYEES table.
4. Display the last name concatenated with job ID, separated by a comma and space, and name the
column Employee and Title.
5. Create a query to display all data from the EMPLOYEE table. Separate each column by a comma.
Name the column THE_OUTPUT.
6. There are four coding errors in this statement. Can you identify them?
SELECT employee_id, last_name
Sal * 12 ANNUAL SALARY
FROM employees

B.2: Write an observation according to the query execution.

B.3: Write the query execution sequence in terms of the clauses. (Sequences of clauses)

You might also like