Oracle 11g DATABASE DEVELOPMENT LAB2. Chapter- 2  These commands, which could be issued from SQL*Plus or SQL Developer,  will make it possible to log.

Slides:



Advertisements
Similar presentations
Database Programming Sections 5 & 6 – Group functions, COUNT, DISTINCT, NVL, GROUP BY, HAVING clauses, Subqueries.
Advertisements

LECTURE 8.  Consider the table employee(employee_id,last_name,job_id, department_id )  assume that you want to display all the employees in department.
Writing Basic SQL SELECT Statements. Capabilities of SQL SELECT Statements A SELECT statement retrieves information from the database. Using a SELECT.
Restricting and Sorting Data. Consider the table employee(employee_id,last_name,job_id, department_id ) assume that you want to display all the employees.
8 Copyright © Oracle Corporation, All rights reserved. Manipulating Data.
1 Copyright © Oracle Corporation, All rights reserved. Writing Basic SQL SELECT Statements.
2 Copyright © 2004, Oracle. All rights reserved. Restricting and Sorting Data.
WRITING BASIC SQL SELECT STATEMENTS Lecture 7 1. Outlines  SQL SELECT statement  Capabilities of SELECT statements  Basic SELECT statement  Selecting.
Chapter 1 Writing Basic SQL Statements Important Legal Notice:  Materials on this lecture are from a book titled “Oracle Education” by Kochhar, Gravina,
Ceng 356-Lab2. Objectives After completing this lesson, you should be able to do the following: Limit the rows that are retrieved by a query Sort the.
Ceng 356-Lab1. Objectives After completing this lesson, you should be able to do the following: Get Familiar with the development environment List the.
1 Copyright © Oracle Corporation, All rights reserved. Writing Basic SQL SELECT Statements.
1 Copyright © 2006, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
Restricting and Sorting Data. ◦ Limiting rows with:  The WHERE clause  The comparison conditions using =,
2 Copyright © Oracle Corporation, All rights reserved. Restricting and Sorting Data.
2 Copyright © 2004, Oracle. All rights reserved. Restricting and Sorting Data.
4 Copyright © 2006, Oracle. All rights reserved. Restricting and Sorting Data.
LECTURE 8.  Consider the table employee(employee_id,last_name,job_id, department_id )  assume that you want to display all the employees in department.
SQL (DDL & DML Commands)
Database control Introduction. The Database control is a tool that used by the database administrator to control the database. To enter to Database control.
Copyright  Oracle Corporation, All rights reserved. Writing Basic SQL Statements.
Copyright س Oracle Corporation, All rights reserved. I Introduction.
Quick review of SQL And conversion to Oracle SQL.
11 Copyright © Oracle Corporation, All rights reserved. Creating Views.
Oracle 11g DATABASE DEVELOPMENT LAB1. Introduction  Oracle 11g Database:-  Oracle 11g database is designed for some features, which helps to the organizations.
Introduction to SQL PART Ⅰ 第一讲 Writing Basic SQL SELECT Statements.
2 第二讲 Restricting and Sorting Data. Objectives After completing this lesson, you should be able to do the following: Limit the rows retrieved by a query.
Copyright © 2004, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement Satrio Agung Wicaksono, S.Kom., M.Kom.
Copyright © 2004, Oracle. All rights reserved. Lecture 4: 1-Retrieving Data Using the SQL SELECT Statement 2-Restricting and Sorting Data Lecture 4: 1-Retrieving.
2 Copyright © 2004, Oracle. All rights reserved. Restricting and Sorting Data.
15 Copyright © Oracle Corporation, All rights reserved. Using SET Operators.
Copyright © 2004, Oracle. All rights reserved. Using the Set Operators.
Using SET Operators Fresher Learning Program January, 2012.
1 Copyright © Oracle Corporation, All rights reserved. Writing Basic SQL SELECT Statements.
2 Copyright © 2009, Oracle. All rights reserved. Restricting and Sorting Data.
I Copyright © 2007, Oracle. All rights reserved. Introduction.
I Copyright © 2007, Oracle. All rights reserved. Introduction.
1-1 Copyright  Oracle Corporation, All rights reserved. Logging In to SQL*Plus From Windows environment:From Windows environment: From command line:From.
4 Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Using Data Model Editor to Create Data Models Based on a SQL Query Data Set.
Simple Queries DBS301 – Week 1. Objectives Basic SELECT statement Computed columns Aliases Concatenation operator Use of DISTINCT to eliminate duplicates.
Writing Basic SQL Statements. Objectives After completing this lesson, you should be able to do the following: –List the capabilities of SQL SELECT statements.
1 Copyright © 2007, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
Oracle 10g Retrieving Data Using the SQL SELECT Statement.
1 Copyright © 2009, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
Copyright س Oracle Corporation, All rights reserved. 1 Writing Basic SQL Statements.
1 Copyright © 2004, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
Restricting and Sorting Data
Retrieving Data Using the SQL SELECT Statement
Basic CRUD in SQL Server
Writing Basic SQL SELECT Statements
Chapter 1 Introduction.
Basic select statement
Restricting and Sorting Data
Manipulating Data.
Using the Set Operators
Restricting and Sorting Data
Writing Basic SQL SELECT Statements
Chapter 1 Introduction.
Restricting and Sorting Data
Chapter 2 Views.
Manipulating Data.
Writing Basic SQL SELECT Statements
Chapter 2 Views.
Restricting and Sorting Data
Using CASE Value expression
Chapter 1 Introduction.
Chapter 1 Introduction.
Using the Set Operators
Restricting and Sorting Data
Presentation transcript:

Oracle 11g DATABASE DEVELOPMENT LAB2

Chapter- 2  These commands, which could be issued from SQL*Plus or SQL Developer,  will make it possible to log on as users HR and OE using the passwords HR and OE:  alter user hr account unlock identified by hr;  alter user oe account unlock identified by oe;.  Now login to sqlplus using the user name and password  Hr

Chapter- 2  Arithmetic expression to calculate number of days worked.

Chapter- 2 .. Use of the concatenation and arithmetic operators

Chapter- 2 .. Use of column and expression aliases

Chapter- 2 .. Use of the AS keyword to specify column aliases

Chapter- 2 .. Null values in the Commission_Pct column

Chapter- 2 .. Null arithmetic always returns a null value.

Chapter- 2 . Question 1: It was demonstrated earlier how the number of days for which staff were employed in a job could be calculated. For how many years were staff employed while fulfilling these job roles and what were their EMPLOYEE_ID, JOB_ID, START_DATE, and END_DATE values? Alias the expression column in your query with the alias Years Employed. Assume that a year consists of days.  select employee_id, job_id, start_date, end_date,  ((end_date-start_date) + 1)/ "Years Employed"  from job_history;

Chapter- 2 ..

.. select 'The Job Id for the '||job_title||'''s job is: '||job_id AS "Job Description“ from jobs;

Chapter- 2 .. Character column-based WHERE clause

Chapter- 2 .. Equivalence of conditional expressions

Chapter- 2  Statement 1:  select employee_id from job_history  where start_date = end_date;  Statement 2:  select employee_id from job_history  where start_date = '01-JAN-2001';  Statement 3:  select employee_id from job_history  where start_date = '01-JAN-01';  Statement 4:  select employee_id from job_history  where start_date = '01-JAN-99';.

Chapter- 2 .. Using the WHERE clause with numeric expressions

Chapter- 2 .. Conditions based on the equality operator

Chapter- 2 .. Conditions based on the inequality operators

Chapter- 2 select last_name from employees where salary between 3400 and 4000; select last_name from employees where salary >= 3400 and salary <= 4000; select first_name, hire_date from employees where hire_date between '24-JUL-1994' and '07-JUN-1996'; select first_name, hire_date from employees where '24-JUL-1994' between hire_date+30 and '07-JUN-1996';.

Chapter- 2 select last_name from employees where salary in (1000,4000,6000); select last_name from employees where salary = 1000 OR salary = 4000 OR salary = 6000; select last_name from employees where last_name in ('King','Garbharran','Ramklass'); select last_name from employees where hire_date in ('01-JAN-1998','01-DEC-1999');.

Chapter- 2 select first_name from employees where first_name like 'A%'; where first_name like '%'; where last_name like 'King'; where last_name = 'King'; . Pattern Comparison with the LIKE Operator

Chapter- 2 ..