This document discusses how to restrict and sort data retrieved by SQL queries. It describes how to limit rows using the WHERE clause with various comparison operators like equal to, greater than, between, in, like, and is null. Logical operators like AND, OR and NOT can be used with WHERE. Rows can be sorted using the ORDER BY clause, specifying columns and expressions to sort on in ascending or descending order. Multiple columns can be used in the ORDER BY to further refine the sorting.
Displaying Data from Multiple Tables - Oracle Data BaseSalman Memon
After completing this lesson, you should be able to
do the following:
Write SELECT statements to access data from more than one table using equality and nonequality joins
View data that generally does not meet a join condition by using outer joins
Join a table to itself by using a self join
http://phpexecutor.com
Single-Row Functions in orcale Data baseSalman Memon
After completing this lesson, you should be able to
do the following:
Describe various types of functions availablein SQL
Use character, number, and date functions in SELECT statements
Describe the use of conversion functions
http://phpexecutor.com
After completing this lesson, you should be able to
do the following:
List the capabilities of SQL SELECT statements
Execute a basic SELECT statement
Differentiate between SQL statements and iSQL*Plus commands
http://phpexecutor.com
After completing this lesson, you should be able to
do the following:
Describe the types of problem that subqueries can solve
Define subqueries
List the types of subqueries
Write single-row and multiple-row subqueries
http://phpexecutor.com
After completing this lesson, you should be able to
do the following:
Describe each DML statement
Insert rows into a table
Update rows in a table
Delete rows from a table
Merge rows in a table
Control transactions
http://phpexecutor.com
Displaying Data from Multiple Tables - Oracle Data BaseSalman Memon
After completing this lesson, you should be able to
do the following:
Write SELECT statements to access data from more than one table using equality and nonequality joins
View data that generally does not meet a join condition by using outer joins
Join a table to itself by using a self join
http://phpexecutor.com
Single-Row Functions in orcale Data baseSalman Memon
After completing this lesson, you should be able to
do the following:
Describe various types of functions availablein SQL
Use character, number, and date functions in SELECT statements
Describe the use of conversion functions
http://phpexecutor.com
After completing this lesson, you should be able to
do the following:
List the capabilities of SQL SELECT statements
Execute a basic SELECT statement
Differentiate between SQL statements and iSQL*Plus commands
http://phpexecutor.com
After completing this lesson, you should be able to
do the following:
Describe the types of problem that subqueries can solve
Define subqueries
List the types of subqueries
Write single-row and multiple-row subqueries
http://phpexecutor.com
After completing this lesson, you should be able to
do the following:
Describe each DML statement
Insert rows into a table
Update rows in a table
Delete rows from a table
Merge rows in a table
Control transactions
http://phpexecutor.com
Cursores en Oracle PL/SQL, en esta presentación se encuentra información sobre que son, cuando se debe usar, su creación, invocación y también su eliminación.
Aggregating Data Using Group FunctionsSalman Memon
After completing this lesson, you should be able to
do the following:
Identify the available group functions
Describe the use of group functions
Group data using the GROUP BY clause
Include or exclude grouped rows by using the HAVING clause
http://phpexecutor.com
Creating and Managing Tables -Oracle Data base Salman Memon
After completing this lesson, you should be able to
do the following:
Describe the main database objects
Create tables
Describe the data types that can be used when specifying column definition
Alter table definitions
Drop, rename, and truncate tables
http://phpexecutor.com
Producing Readable Output with iSQL*Plus - Oracle Data BaseSalman Memon
After completing this lesson, you should be able to
do the following:
Produce queries that require a substitution variable
Customize the iSQL*Plus environment
Produce more readable output
Create and execute script files
http://phpexecutor.com
After completing this lesson, you should be able to
do the following:
Create, maintain, and use sequences
Create and maintain indexes
Create private and public synonyms
http://phpexecutor.com
This presentation deals with the fundamentals of SQL, Installation and Database concepts. Presented by our team in Alphalogic Inc: https://www.alphalogicinc.com/
After completing this lesson, you should be able
to do the following:
Describe a view
Create, alter the definition of, and drop a view
Retrieve data through a view
Insert, update, and delete data througha view
Create and use an inline view
Perform “Top-N” analysis
http://phpexecutor.com
Absolutely Typical - The whole story on Types and how they power PL/SQL Inter...Lucas Jellema
This session will convince database developers that types in the Oracle Database are worth their salt - and more. With the recent improvements in 11gR2, the pieces are available to complete the puzzle of structured and modern programming with a touch of OO and more importantly to create a decoupled, reusable API that exposes services based on tables and views to clients that speak SQL, AQ, PL/SQL, Types, XML or RESTful, through SQL*Net, JDBC or HTTP. This session shows through many demonstrations how types and collections are defined, how they are used between SQL and PL/SQL and how they can be converted to and from XML and JSON and how they drive Native WebServices as well as RESTful services based on the Embedded PL/SQL Gateway. Everyone doing PL/SQL programming will benefit immediately from this session.
Every Database Developer should be aware of Types and Collections. For structured programming, for optimal SQL to PL/SQL integration and for interoperability to client application. This session introduces Types and Collections, their OO capabilities, the conversion to XML and JSON, their use in Native and RESTful WebServices and the pivotal role they can play in encapsulation and decoupling.
Cursores en Oracle PL/SQL, en esta presentación se encuentra información sobre que son, cuando se debe usar, su creación, invocación y también su eliminación.
Aggregating Data Using Group FunctionsSalman Memon
After completing this lesson, you should be able to
do the following:
Identify the available group functions
Describe the use of group functions
Group data using the GROUP BY clause
Include or exclude grouped rows by using the HAVING clause
http://phpexecutor.com
Creating and Managing Tables -Oracle Data base Salman Memon
After completing this lesson, you should be able to
do the following:
Describe the main database objects
Create tables
Describe the data types that can be used when specifying column definition
Alter table definitions
Drop, rename, and truncate tables
http://phpexecutor.com
Producing Readable Output with iSQL*Plus - Oracle Data BaseSalman Memon
After completing this lesson, you should be able to
do the following:
Produce queries that require a substitution variable
Customize the iSQL*Plus environment
Produce more readable output
Create and execute script files
http://phpexecutor.com
After completing this lesson, you should be able to
do the following:
Create, maintain, and use sequences
Create and maintain indexes
Create private and public synonyms
http://phpexecutor.com
This presentation deals with the fundamentals of SQL, Installation and Database concepts. Presented by our team in Alphalogic Inc: https://www.alphalogicinc.com/
After completing this lesson, you should be able
to do the following:
Describe a view
Create, alter the definition of, and drop a view
Retrieve data through a view
Insert, update, and delete data througha view
Create and use an inline view
Perform “Top-N” analysis
http://phpexecutor.com
Absolutely Typical - The whole story on Types and how they power PL/SQL Inter...Lucas Jellema
This session will convince database developers that types in the Oracle Database are worth their salt - and more. With the recent improvements in 11gR2, the pieces are available to complete the puzzle of structured and modern programming with a touch of OO and more importantly to create a decoupled, reusable API that exposes services based on tables and views to clients that speak SQL, AQ, PL/SQL, Types, XML or RESTful, through SQL*Net, JDBC or HTTP. This session shows through many demonstrations how types and collections are defined, how they are used between SQL and PL/SQL and how they can be converted to and from XML and JSON and how they drive Native WebServices as well as RESTful services based on the Embedded PL/SQL Gateway. Everyone doing PL/SQL programming will benefit immediately from this session.
Every Database Developer should be aware of Types and Collections. For structured programming, for optimal SQL to PL/SQL integration and for interoperability to client application. This session introduces Types and Collections, their OO capabilities, the conversion to XML and JSON, their use in Native and RESTful WebServices and the pivotal role they can play in encapsulation and decoupling.
http://pebbleit.com.au/index.php/database-services/ - Databases are the engines that drive your business. At the core of almost every application, databases provide underlying support to your customer service, production, distribution, and internal operations. We offer a wealth of experience in providing remote DBA support and a complete range of complementary Oracle Database services.
Oracle Enterprise Manager is a set of system management tools from Oracle for managing the business Oracle stack and even some non-oracle products.
The tools work to monitor the Oracle environment, automating tasks to make database application and cloud management easier for the business
Here at http://www.pebbleit.com.au, we have all the Oracle expertise you may need. We can advise specifically on the implementation and management of Oracle Enterprise Manager and how best this can be configured for your database setup
Best Oracle and Hadoop Institute: orienit is the best Oracle Institute in Hyderabad.Providing oracle courses and Hadoop courses by realtime faculty in hyderabad.
Oracle Enterprise Manager 12c: The Oracle Monitoring tool of choice – Why yo...Jeff Kayser
OEM 12c has a much different architecture than 11g, and it is *so* much better. ITIL-like event management, pluggable target types, a new security model, etc. Wow – not just a face lift! Come and see Oracle’s latest monitoring and management technology and hear about best practices for implementing.
The Top Skills That Can Get You Hired in 2017LinkedIn
We analyzed all the recruiting activity on LinkedIn this year and identified the Top Skills employers seek. Starting Oct 24, learn these skills and much more for free during the Week of Learning.
#AlwaysBeLearning https://learning.linkedin.com/week-of-learning
To extract data from the database, you need to use the structured query language (SQL) SELECT statement. You may need to restrict the columns that are displayed. This lesson describes all the SQL statements needed to perform these actions.You may want to create SELECT statements that can be used more than once. This lesson also covers the iSQL*Plus environment where you execute SQL statements.
Note: iSQL*Plus is new in the Oracle9i product. It is a browser environment where you execute SQL commands. In prior releases of Oracle, SQL*Plus was the default environment where you executed SQL commands. SQL*Plus is still available and is described in Appendix C.
Les04 Displaying Data from Multiple Tables.pptDrZeeshanBhatti
This lesson covers how to obtain data from more than one table.
Sometimes you need to use data from more than one table. In the slide example, the report displays data from two separate tables.
Employee IDs exist in the EMPLOYEES table.
Department IDs exist in both the EMPLOYEES and DEPARTMENTS tables.
Location IDs exist in the DEPARTMENTS table.
To produce the report, you need to link the EMPLOYEES and DEPARTMENTS tables and access data from both of them.
Les03 Single Row Functions in Oracle and SQL.pptDrZeeshanBhatti
Functions make the basic query block more powerful and are used to manipulate data values. This is the first of two lessons that explore functions. It focuses on single-row character, number, and date functions, as well as those functions that convert data from one type to another, for example, character data to numeric data.
Organizations are “collections of people working together, in divisions of labor, to achieve a common purpose.”
“Synergy” = the creation of a whole that is greater than the sum of its parts.
Open systems exchange input and output with the environment.
http://phpexecutor.com
Topics that will be emphasized in this class include
Technology Strategy
Development of Technological capability
Innovation management
Technology management and business competitiveness interface
Technology adoption
E-business and Virtual Corporation
http://phpexecutor.com
Align Information Technology and Business Strategy Salman Memon
Align Information Technology and Business Strategy
The mission critical, long-term IT choices made by a firm.
Commitment to build IT capability
http://phpexecutor.com
WHITE BOX & BLACK BOXTESTING IN DATABASESalman Memon
White box & black box are software testing methods.
Software testing is a process that should be done during the development process. In other words software testing is a verification and validation process.
Verification : is the process to make sure the product satisfies the conditions imposed at the start of the development phase. In other words, to make sure the product behaves the way we want it to.
http://phpexecutor.com
E-Mail Electronic mail
A method of exchanging messages in digital form.
E-mail systems are based on a store-and-forward method in which e-mail server accept, forwards, delivers and stores messages on behalf of users.
Users only need to connect to the internet through a computer for the duration of message submission or retrieval
http://phpexecutor.com
Electronic mail, most commonly called email or e-mail since around 1993
E-mail is one of the most widely used forms of communication today.
E-mail is faster and cheaper than traditional postal mail, but at least when you seal that envelope and stick a stamp on it, you can have some confidence that only the intended recipient will open it.
With e-mail, however, your message could be intercepted midstream, and you might never realize it. You have to take steps to secure and protect your e-mail messages.
http://phpexecutor.com
Process of minimizing the resource usage.
Aims of Query Decomposition
To transform a high-level query into a Relational Algebra query
&
To check the query is syntactically and semantically correct
It is efficient way to retrieve data
from database.
http://phpexecutor.com
Time management is an art. It is arranging, organizing and budgeting time for the purpose of accomplishing something within a time.
Time management is having control over the amount of time spent on a particular activity.
Hence, time management helps an individual to be more organized and more productive.
http://phpexecutor.com
What is video conferencing
A videoconference is a live connection between people in separate locations for the purpose of communication, usually involving audio and often text as well as video. At its simplest, videoconferencing provides transmission of static images and text between two locations. At its most sophisticated, it provides transmission of full-motion video images and high-quality audio between multiple locations.
http://phpexecutor.com
A hash function usually means a function that compresses, meaning the output is shorter than the input
A hash function takes a group of characters (called a key) and maps it to a value of a certain length (called a hash value or hash).
The hash value is representative of the original string of characters, but is normally smaller than the original.
This term is also known as a hashing algorithm or message digest function.
Hash functions also called message digests or one-way encryption or hashing algorithm.
http://phpexecutor.com
DATA
Data is any raw material or unorganized information.
CLUSTER
Cluster is group of objects that belongs to a same class.
Cluster is a set of tables physically stored together as one table that shares common columns.
http://phpexecutor.com
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Lesson Aim
While retrieving data from the database, you may need to restrict the rows of data that are displayed or specify the order in which the rows are displayed. This lesson explains the SQL statements that you use to perform these actions.
Limiting Rows Using a Selection
In the example on the slide, assume that you want to display all the employees in department 90. The rows with a value of 90 in the DEPARTMENT_ID column are the only ones returned. This method of restriction is the basis of the WHERE clause in SQL.
Limiting the Rows Selected
You can restrict the rows returned from the query by using the WHERE clause. A WHERE clause contains a condition that must be met, and it directly follows the FROM clause. If the condition is true, the row meeting the condition is returned.
In the syntax:
WHERErestricts the query to rows that meet a condition
conditionis composed of column names, expressions, constants, and a comparison operator
The WHERE clause can compare values in columns, literal values, arithmetic expressions, or functions. It consists of three elements:
Column name
Comparison condition
Column name, constant, or list of values
Using the WHERE Clause
In the example, the SELECT statement retrieves the name, job ID, and department number of all employees whose job ID is SA_REP.
Note that the job title SA_REP has been specified in uppercase to ensure that it matches the job ID column in the EMPLOYEES table. Character strings are case sensitive.
Character Strings and Dates
Character strings and dates in the WHERE clause must be enclosed in single quotation marks (''). Number constants, however, should not be enclosed in single quotation marks.
All character searches are case sensitive. In the following example, no rows are returned because the EMPLOYEES table stores all the last names in mixed case:
SELECT last_name, job_id, department_id
FROM employees
WHERE last_name = 'WHALEN';
Oracle databases store dates in an internal numeric format, representing the century, year, month, day, hours, minutes, and seconds. The default date display is DD-MON-RR.
Note: Changing the default date format is covered in a subsequent lesson.
Instructor Note
Some students may ask how to override the case sensitivity. Later in the course, we cover the use of single-row functions such as UPPER and LOWER to override the case sensitivity.
Comparison Conditions
Comparison conditions are used in conditions that compare one expression to another value or expression. They are used in the WHERE clause in the following format:
Syntax
... WHERE expr operator value
For Example
... WHERE hire_date='01-JAN-95'
... WHERE salary>=6000
... WHERE last_name='Smith'
An alias cannot be used in the WHERE clause.
Note: The symbol != and ^= can also represent the not equal to condition.
Using the Comparison Conditions
In the example, the SELECT statement retrieves the last name and salary from the EMPLOYEES table, where the employee salary is less than or equal to 3000. Note that there is an explicit value supplied to the WHERE clause. The explicit value of 3000 is compared to the salary value in the SALARY column of the EMPLOYEES table.
The BETWEEN Condition
You can display rows based on a range of values using the BETWEEN range condition. The range that you specify contains a lower limit and an upper limit.
The SELECT statement on the slide returns rows from the EMPLOYEES table for any employee whose salary is between $2,500 and $3,500.
Values specified with the BETWEEN condition are inclusive. You must specify the lower limit first.
Instructor Note
Emphasize that the values specified with the BETWEEN operator in the example are inclusive. Explain that BETWEEN … AND … is actually translated by Oracle server to a pair of AND conditions: (a >= lower limit) AND (a <= higher limit). So using BETWEEN … AND … has no performance benefits, and it is used for logical simplicity.
Demo: 2_betw.sql
Purpose: To illustrate using the BETWEEN operator.
The IN Condition
To test for values in a specified set of values, use the IN condition. The IN condition is also known as the membership condition.
The slide example displays employee numbers, last names, salaries, and manager’s employee numbers for all the employees whose manager’s employee number is 100, 101, or 201.
The IN condition can be used with any data type. The following example returns a row from the EMPLOYEES table for any employee whose last name is included in the list of names in the WHERE clause:
SELECT employee_id, manager_id, department_id
FROM employees
WHERE last_name IN ('Hartstein', 'Vargas');
If characters or dates are used in the list, they must be enclosed in single quotation marks ('').
Instructor Note
Explain that IN ( ... ) is actually translated by Oracle server to a set of OR conditions: a = value1 OR a = value2 OR a = value3. So using IN ( ... ) has no performance benefits, and it is used for logical simplicity.
Demo: 2_in.sql
Purpose: To illustrate using the IN operator.
The LIKE Condition
You may not always know the exact value to search for. You can select rows that match a character pattern by using the LIKE condition. The character pattern-matching operation is referred to as a wildcard search. Two symbols can be used to construct the search string.
The SELECT statement on the slide returns the employee first name from the EMPLOYEES table for any employee whose first name begins with an S. Note the uppercase S. Names beginning with an s are not returned.
The LIKE condition can be used as a shortcut for some BETWEEN comparisons. The following example displays the last names and hire dates of all employees who joined between January 1995 and December 1995:
SELECT last_name, hire_date
FROM employees
WHERE hire_date LIKE '%95';
Combining Wildcard Characters
The % and _ symbols can be used in any combination with literal characters. The example on the slide displays the names of all employees whose last names have an o as the second character.
The ESCAPE Option
When you need to have an exact match for the actual % and _ characters, use the ESCAPE option. This option specifies what the escape character is. If you want to search for strings that contain ‘SA_’, you can use the following SQL statement:
SELECT employee_id, last_name, job_id
FROM employees
WHERE job_id LIKE '%SA\_%' ESCAPE '\';
The ESCAPE option identifies the backslash (\) as the escape character. In the pattern, the escape character precedes the underscore (_). This causes the Oracle Server to interpret the underscore literally.
The NULL Conditions
The NULL conditions include the IS NULL condition and the IS NOT NULL condition.
The IS NULL condition tests for nulls. A null value means the value is unavailable, unassigned, unknown, or inapplicable. Therefore, you cannot test with = because a null cannot be equal or unequal to any value. The slide example retrieves the last names and managers of all employees who do not have a manager.
For another example, to display last name, job ID, and commission for all employees who are NOT entitled to get a commission, use the following SQL statement:
SELECT last_name, job_id, commission_pct
FROM employees
WHERE commission_pct IS NULL;
Logical Conditions
A logical condition combines the result of two component conditions to produce a single result based on them or inverts the result of a single condition. A row is returned only if the overall result of the condition is true. Three logical operators are available in SQL:
AND
OR
NOT
All the examples so far have specified only one condition in the WHERE clause. You can use several conditions in one WHERE clause using the AND and OR operators.
The AND Operator
In the example, both conditions must be true for any record to be selected. Therefore, only employees who have a job title that contains the string MAN and earn $10,000 or more are selected.
All character searches are case sensitive. No rows are returned if MAN is not in uppercase. Character strings must be enclosed in quotation marks.
AND Truth Table
The following table shows the results of combining two expressions with AND:
Instructor Note
Demo: 2_and.sql
Purpose: To illustrate using the AND operator.
The OR Operator
In the example, either condition can be true for any record to be selected. Therefore, any employee who has a job ID containing MAN or earns $10,000 or more is selected.
The OR Truth Table
The following table shows the results of combining two expressions with OR:
Instructor Note
Demo: 2_or.sql
Purpose: To illustrate using the OR operator.
The NOT Operator
The slide example displays the last name and job ID of all employees whose job ID is not IT_PROG, ST_CLERK, or SA_REP.
The NOT Truth Table
The following table shows the result of applying the NOT operator to a condition:
Note: The NOT operator can also be used with other SQL operators, such as BETWEEN, LIKE, and NULL.
... WHERE job_id NOT IN ('AC_ACCOUNT', 'AD_VP')
... WHERE salary NOT BETWEEN 10000 AND 15000
... WHERE last_name NOT LIKE '%A%'
... WHERE commission_pct IS NOT NULL
Rules of Precedence
The rules of precedence determine the order in which expressions are evaluated and calculated. The table lists the default order of precedence. You can override the default order by using parentheses around the expressions you want to calculate first.
Example of the Precedence of the AND Operator
In the slide example, there are two conditions:
The first condition is that the job ID is AD_PRES and the salary is greater than 15,000.
The second condition is that the job ID is SA_REP.
Therefore, the SELECT statement reads as follows:
“Select the row if an employee is a president and earns more than $15,000, or if the employee is a sales representative.”
Instructor Note
Demo: 2_sal1.sql
Purpose: To illustrate the rules of precedence.
Using Parentheses
In the example, there are two conditions:
The first condition is that the job ID is AD_PRES or SA_REP.
The second condition is that salary is greater than $15,000.
Therefore, the SELECT statement reads as follows:
“Select the row if an employee is a president or a sales representative, and if the employee earns more than $15,000.”
Instructor Note
Demo: 2_sal2.sql
Purpose: To illustrate the rules of precedence.
The ORDER BY Clause
The order of rows returned in a query result is undefined. The ORDER BY clause can be used to sort the rows. If you use the ORDER BY clause, it must be the last clause of the SQL statement. You can specify an expression, or an alias, or column position as the sort condition.
Syntax
SELECT expr
FROM table
[WHERE condition(s)]
[ORDER BY{column, expr} [ASC|DESC]];
In the syntax:
ORDER BYspecifies the order in which the retrieved rows are displayed
ASCorders the rows in ascending order (this is the default order)
DESCorders the rows in descending order
If the ORDER BY clause is not used, the sort order is undefined, and the Oracle server may not fetch rows in the same order for the same query twice. Use the ORDER BY clause to display the rows in a specific order.
Instructor Note
Let the students know that the ORDER BY clause is executed last in query execution. It is placed last unless the FOR UPDATE clause is used.
Default Ordering of Data
The default sort order is ascending:
Numeric values are displayed with the lowest values first—for example, 1–999.
Date values are displayed with the earliest value first—for example, 01-JAN-92 before 01-JAN-95.
Character values are displayed in alphabetical order—for example, A first and Z last.
Null values are displayed last for ascending sequences and first for descending sequences.
Reversing the Default Order
To reverse the order in which rows are displayed, specify the DESC keyword after the column name in the ORDER BY clause. The slide example sorts the result by the most recently hired employee.
Instructor Note
Let the students know that you can also sort by a column number in the SELECT list. The following example sorts the output in the descending order by salary:
SELECT last_name, salary
FROM employees
ORDER BY 2 DESC;
Sorting by Column Aliases
You can use a column alias in the ORDER BY clause. The slide example sorts the data by annual salary.
Instructor Note
Internally, the order of execution for a SELECT statement is as follows:
FROM clause
WHERE clause
SELECT clause
ORDER BY clause
Sorting by Multiple Columns
You can sort query results by more than one column. The sort limit is the number of columns in the given table.
In the ORDER BY clause, specify the columns, and separate the column names using commas. If you want to reverse the order of a column, specify DESC after its name. You can also order by columns that are not included in the SELECT clause.
Example
Display the last names and salaries of all employees. Order the result by department number, and then in descending order by salary.
SELECT last_name, salary
FROM employees
ORDER BY department_id, salary DESC;
Instructor Note
Show that the DEPARTMENT_ID column is sorted in ascending order and the SALARY column in descending order.
Summary
In this lesson, you should have learned about restricting and sorting rows returned by the SELECT statement. You should also have learned how to implement various operators and conditions.
Practice 2 Overview
This practice gives you a variety of exercises using the WHERE clause and the ORDER BY clause.
Practice 2
1.Create a query to display the last name and salary of employees earning more than $12,000.Place your SQL statement in a text file named lab2_1.sql. Run your query.
2.Create a query to display the employee last name and department number for employee number176.
3.Modify lab2_1.sql to display the last name and salary for all employees whose salary is not in the range of $5,000 and $12,000. Place your SQL statement in a text file named lab2_3.sql.
Practice 2 (continued)
4.Display the employee last name, job ID, and start date of employees hired between February 20, 1998, and May 1, 1998. Order the query in ascending order by start date.
5.Display the last name and department number of all employees in departments 20 and 50 in alphabetical order by name.
6.Modify lab2_3.sql to list the last name and salary of employees who earn between $5,000 and $12,000, and are in department 20 or 50. Label the columns Employee and Monthly Salary, respectively. Resave lab2_3.sql as lab2_6.sql. Run the statement in lab2_6.sql.
Practice 2 (continued)
7.Display the last name and hire date of every employee who was hired in 1994.
8.Display the last name and job title of all employees who do not have a manager.
9.Display the last name, salary, and commission for all employees who earn commissions. Sortdata in descending order of salary and commissions.
If you have time, complete the following exercises:
10.Display the last names of all employees where the third letter of the name is an a.
11.Display the last name of all employees who have an a and an e in their last name.
Practice 2 (continued)
If you want an extra challenge, complete the following exercises:
12.Display the last name, job, and salary for all employees whose job is sales representative or stock clerk and whose salary is not equal to $2,500, $3,500, or $7,000.
13.Modify lab2_6.sql to display the last name, salary, and commission for all employees whose commission amount is 20%. Resave lab2_6.sql as lab2_13.sql. Rerun the statement in lab2_13.sql.