This document provides an overview of basic SQL statements and the SQL*Plus environment. It describes how to write and execute basic SELECT statements to retrieve data from tables, use arithmetic operators and column aliases, and eliminate duplicate rows. It also explains how to use SQL*Plus commands to describe table structures, edit and run SQL statements, and save statements to files for execution. The key objectives are to learn how to write basic SELECT statements and differentiate between SQL statements and SQL*Plus commands.
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 SQL*Plus commands
This document provides an overview of basic SQL statements and SQL*Plus commands. It describes how to select data from tables, perform calculations, define column aliases, and eliminate duplicate rows using the SELECT statement. It also outlines how to describe table structures, edit SQL statements, execute SQL within SQL*Plus, and load and save SQL files. The key goals of SQL statements are to select, project, and join data, while SQL*Plus is the environment used to execute SQL and manage database interactions.
This document provides an overview of basic SQL statements and SQL*Plus commands. It covers the capabilities of SELECT statements, including selecting all columns, specific columns, column aliases, arithmetic expressions, and literal strings. It also discusses null values, the concatenation operator, and eliminating duplicate rows with DISTINCT. Finally, it differentiates between SQL statements and SQL*Plus commands, describing how to log in to SQL*Plus, display table structure, edit SQL, and execute files of SQL statements.
Les08[1] Producing Readable Output with SQL*Plussiavosh kaviani
After completing this lesson, you should be able to do the following:
Produce queries that require an input variable
Customize the SQL*Plus environment
Produce more readable output
Create and execute script files
Save customizations
This document provides an overview of basic SQL statements and SQL*Plus commands. It describes how to select data from tables using the SELECT statement, perform calculations, and give columns aliases. It also summarizes how to describe table structures, edit SQL statements, and execute saved SQL files using SQL*Plus commands. The key capabilities of the SELECT statement are selection, projection, and joining data from multiple tables.
This document provides an overview of basic SQL statements and SQL*Plus commands. It discusses SQL SELECT statements and their capabilities including selection, projection, and joins. It also demonstrates basic SELECT syntax and examples for selecting columns, arithmetic expressions, column aliases, concatenation, and literal strings. The document concludes with the differences between SQL statements and SQL*Plus commands and how to log in and describe tables using SQL*Plus.
This document provides an overview of basic SQL statements and SQL*Plus commands. It covers capabilities of SELECT statements, executing a basic SELECT statement, writing SQL statements, selecting specific columns, using arithmetic expressions and operators, defining aliases and literals, eliminating duplicate rows, and interacting with SQL*Plus through commands like editing, saving, and running SQL statements.
The document provides an overview of basic SQL statements and capabilities. It discusses using SELECT statements to project columns, select rows, and join tables. It also covers arithmetic expressions, column aliases, concatenation, and eliminating duplicate rows. SQL statements are executed through the SQL*Plus environment, which allows editing, saving, and running SQL code and commands.
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 SQL*Plus commands
This document provides an overview of basic SQL statements and SQL*Plus commands. It describes how to select data from tables, perform calculations, define column aliases, and eliminate duplicate rows using the SELECT statement. It also outlines how to describe table structures, edit SQL statements, execute SQL within SQL*Plus, and load and save SQL files. The key goals of SQL statements are to select, project, and join data, while SQL*Plus is the environment used to execute SQL and manage database interactions.
This document provides an overview of basic SQL statements and SQL*Plus commands. It covers the capabilities of SELECT statements, including selecting all columns, specific columns, column aliases, arithmetic expressions, and literal strings. It also discusses null values, the concatenation operator, and eliminating duplicate rows with DISTINCT. Finally, it differentiates between SQL statements and SQL*Plus commands, describing how to log in to SQL*Plus, display table structure, edit SQL, and execute files of SQL statements.
Les08[1] Producing Readable Output with SQL*Plussiavosh kaviani
After completing this lesson, you should be able to do the following:
Produce queries that require an input variable
Customize the SQL*Plus environment
Produce more readable output
Create and execute script files
Save customizations
This document provides an overview of basic SQL statements and SQL*Plus commands. It describes how to select data from tables using the SELECT statement, perform calculations, and give columns aliases. It also summarizes how to describe table structures, edit SQL statements, and execute saved SQL files using SQL*Plus commands. The key capabilities of the SELECT statement are selection, projection, and joining data from multiple tables.
This document provides an overview of basic SQL statements and SQL*Plus commands. It discusses SQL SELECT statements and their capabilities including selection, projection, and joins. It also demonstrates basic SELECT syntax and examples for selecting columns, arithmetic expressions, column aliases, concatenation, and literal strings. The document concludes with the differences between SQL statements and SQL*Plus commands and how to log in and describe tables using SQL*Plus.
This document provides an overview of basic SQL statements and SQL*Plus commands. It covers capabilities of SELECT statements, executing a basic SELECT statement, writing SQL statements, selecting specific columns, using arithmetic expressions and operators, defining aliases and literals, eliminating duplicate rows, and interacting with SQL*Plus through commands like editing, saving, and running SQL statements.
The document provides an overview of basic SQL statements and capabilities. It discusses using SELECT statements to project columns, select rows, and join tables. It also covers arithmetic expressions, column aliases, concatenation, and eliminating duplicate rows. SQL statements are executed through the SQL*Plus environment, which allows editing, saving, and running SQL code and commands.
After completing this lesson, you should be able to do the following:
Describe the main database objects
Create tables
Describe the datatypes that can be used when specifying column definition
Alter table definitions
Drop, rename, and truncate tables
This document provides a lesson on using SQL SELECT statements to retrieve data from database tables. It covers the basic SELECT statement syntax, arithmetic expressions, NULL values, column aliases, concatenation operators, literal strings, the DISTINCT keyword, and the DESCRIBE command. The objectives are to understand SQL SELECT statement capabilities and execute basic SELECT statements. The lesson agenda outlines these topics and provides examples of SELECT statements using these features.
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 each DML statement
Insert rows into a table
Update rows in a table
Delete rows from a table
Control transactions
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.
This document provides an agenda for an SQL training covering topics like introduction to Oracle, working with SQL languages including operators, functions, integrity constraints, joins, subqueries, and schema objects. It begins with an introduction to relational database concepts and the relational model. It describes normalization and entity relationship modeling. It also demonstrates some basic SQL statements for selecting, restricting, sorting data and using functions. The training materials are copyrighted and all rights are reserved.
The document provides an overview of basic SQL statements and SELECT capabilities. It discusses selecting columns, arithmetic expressions, null values, column aliases, concatenation, literals, and duplicate rows. Examples are given to demonstrate SELECT statements, column selection, calculations, aliases, concatenation, literals, and DISTINCT. The document also describes displaying table structure using the DESCRIBE command in SQL*Plus.
After completing this lesson, you should be able to do the following:
Write a successful SELECT statement in PL/SQL
Declare the datatype and size of a PL/SQL variable dynamically
Write DML statements in PL/SQL
Control transactions in PL/SQL
Determine the outcome of SQL DML statements
This document provides a lesson on using SQL SELECT statements to retrieve data from database tables. It covers the basic SELECT statement syntax, selecting specific columns, column aliases, arithmetic expressions, NULL values, concatenation operators, literal strings, the DISTINCT keyword, and using the DESCRIBE command to view table structures. The objectives are to be able to list the capabilities of SQL SELECT statements and execute a basic SELECT statement.
This document provides an overview of basic SQL statements. It discusses the capabilities of SQL SELECT statements including selection, projection, and joins. It then demonstrates how to write basic SELECT statements by selecting all columns or specific columns from a table. It also covers concepts like column aliases, arithmetic expressions, null values, concatenation operators, and eliminating duplicate rows. Finally, it distinguishes between SQL statements and SQL*Plus commands.
This document provides an overview of basic SQL statements including:
- Executing a basic SELECT statement to retrieve data from tables
- Using functions like SELECT, FROM, and DISTINCT to retrieve specific columns and eliminate duplicates
- Performing calculations on columns using arithmetic operators
- Renaming columns with aliases and concatenating columns
- Describing the structure of tables using the DESCRIBE command
The goal is to learn fundamental SQL skills like selecting, calculating, aliasing columns, and viewing table definitions.
This document provides an overview of basic SQL statements and SQL*Plus commands. It covers SELECT statements to retrieve data from one or more tables, including selecting specific columns, adding column aliases, and performing arithmetic calculations. It also discusses eliminating duplicate rows, concatenating columns, using literal strings, and describing table structures. The key aspects covered are the basic SELECT statement syntax, capabilities of SQL SELECT statements, and using SQL*Plus as an environment to execute and edit SQL statements.
This document provides an overview of Oracle SQL functions. It discusses single-row functions that operate on each row returned, including conversion, character, number, and date functions. Character functions covered include LOWER, UPPER, INITCAP, CONCAT, SUBSTR, LENGTH, and INSTR, which can be used for case conversion and character manipulation.
After completing this lesson, you should be able to do the following:
Describe a view
Create a view
Retrieve data through a view
Alter the definition of a view
Insert, update, and delete data through a view
Drop a view
The document provides instructions on writing basic SQL statements to extract data from a database using the SELECT statement. It covers selecting specific columns or all columns, using arithmetic expressions and operators, defining and working with null values, and defining column aliases. The key aspects covered are the SELECT, FROM, and WHERE clauses, and how to select, calculate, and rename columns in a SQL query.
This document discusses how to limit and sort data retrieved by SQL queries. It describes using the WHERE clause to restrict rows selected and comparison/logical operators like =, BETWEEN, IN, AND and OR in the WHERE clause. It also covers sorting result sets using the ORDER BY clause and specifying ascending or descending order.
This document discusses how to limit and sort data retrieved by SQL queries. It describes using the WHERE clause to restrict rows selected and comparison operators like =, <, and BETWEEN to define conditions. The ORDER BY clause allows sorting retrieved rows in ascending or descending order based on column values. Logical operators like AND, OR, and NOT can combine conditions.
This document discusses how to limit and sort data retrieved by SQL queries. It describes using the WHERE clause to restrict rows selected and comparison operators like =, <, and BETWEEN to define conditions. The ORDER BY clause allows sorting retrieved rows in ascending or descending order based on column values. Logical operators like AND, OR, and NOT can combine conditions.
This document provides an overview of basic SQL statements and concepts. It begins with objectives and aims of the lesson, which are to extract data from a database using SQL SELECT statements and to perform actions like restricting columns. It then covers the capabilities and components of SELECT statements like selection, projection, and joins. Examples are provided of basic SELECT statements to retrieve all or specific columns from a table. The document also discusses column headings, arithmetic expressions, operator precedence, null values, and defining column aliases.
After completing this lesson, you should be able to do the following:
Describe the main database objects
Create tables
Describe the datatypes that can be used when specifying column definition
Alter table definitions
Drop, rename, and truncate tables
This document provides a lesson on using SQL SELECT statements to retrieve data from database tables. It covers the basic SELECT statement syntax, arithmetic expressions, NULL values, column aliases, concatenation operators, literal strings, the DISTINCT keyword, and the DESCRIBE command. The objectives are to understand SQL SELECT statement capabilities and execute basic SELECT statements. The lesson agenda outlines these topics and provides examples of SELECT statements using these features.
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 each DML statement
Insert rows into a table
Update rows in a table
Delete rows from a table
Control transactions
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.
This document provides an agenda for an SQL training covering topics like introduction to Oracle, working with SQL languages including operators, functions, integrity constraints, joins, subqueries, and schema objects. It begins with an introduction to relational database concepts and the relational model. It describes normalization and entity relationship modeling. It also demonstrates some basic SQL statements for selecting, restricting, sorting data and using functions. The training materials are copyrighted and all rights are reserved.
The document provides an overview of basic SQL statements and SELECT capabilities. It discusses selecting columns, arithmetic expressions, null values, column aliases, concatenation, literals, and duplicate rows. Examples are given to demonstrate SELECT statements, column selection, calculations, aliases, concatenation, literals, and DISTINCT. The document also describes displaying table structure using the DESCRIBE command in SQL*Plus.
After completing this lesson, you should be able to do the following:
Write a successful SELECT statement in PL/SQL
Declare the datatype and size of a PL/SQL variable dynamically
Write DML statements in PL/SQL
Control transactions in PL/SQL
Determine the outcome of SQL DML statements
This document provides a lesson on using SQL SELECT statements to retrieve data from database tables. It covers the basic SELECT statement syntax, selecting specific columns, column aliases, arithmetic expressions, NULL values, concatenation operators, literal strings, the DISTINCT keyword, and using the DESCRIBE command to view table structures. The objectives are to be able to list the capabilities of SQL SELECT statements and execute a basic SELECT statement.
This document provides an overview of basic SQL statements. It discusses the capabilities of SQL SELECT statements including selection, projection, and joins. It then demonstrates how to write basic SELECT statements by selecting all columns or specific columns from a table. It also covers concepts like column aliases, arithmetic expressions, null values, concatenation operators, and eliminating duplicate rows. Finally, it distinguishes between SQL statements and SQL*Plus commands.
This document provides an overview of basic SQL statements including:
- Executing a basic SELECT statement to retrieve data from tables
- Using functions like SELECT, FROM, and DISTINCT to retrieve specific columns and eliminate duplicates
- Performing calculations on columns using arithmetic operators
- Renaming columns with aliases and concatenating columns
- Describing the structure of tables using the DESCRIBE command
The goal is to learn fundamental SQL skills like selecting, calculating, aliasing columns, and viewing table definitions.
This document provides an overview of basic SQL statements and SQL*Plus commands. It covers SELECT statements to retrieve data from one or more tables, including selecting specific columns, adding column aliases, and performing arithmetic calculations. It also discusses eliminating duplicate rows, concatenating columns, using literal strings, and describing table structures. The key aspects covered are the basic SELECT statement syntax, capabilities of SQL SELECT statements, and using SQL*Plus as an environment to execute and edit SQL statements.
This document provides an overview of Oracle SQL functions. It discusses single-row functions that operate on each row returned, including conversion, character, number, and date functions. Character functions covered include LOWER, UPPER, INITCAP, CONCAT, SUBSTR, LENGTH, and INSTR, which can be used for case conversion and character manipulation.
After completing this lesson, you should be able to do the following:
Describe a view
Create a view
Retrieve data through a view
Alter the definition of a view
Insert, update, and delete data through a view
Drop a view
The document provides instructions on writing basic SQL statements to extract data from a database using the SELECT statement. It covers selecting specific columns or all columns, using arithmetic expressions and operators, defining and working with null values, and defining column aliases. The key aspects covered are the SELECT, FROM, and WHERE clauses, and how to select, calculate, and rename columns in a SQL query.
This document discusses how to limit and sort data retrieved by SQL queries. It describes using the WHERE clause to restrict rows selected and comparison/logical operators like =, BETWEEN, IN, AND and OR in the WHERE clause. It also covers sorting result sets using the ORDER BY clause and specifying ascending or descending order.
This document discusses how to limit and sort data retrieved by SQL queries. It describes using the WHERE clause to restrict rows selected and comparison operators like =, <, and BETWEEN to define conditions. The ORDER BY clause allows sorting retrieved rows in ascending or descending order based on column values. Logical operators like AND, OR, and NOT can combine conditions.
This document discusses how to limit and sort data retrieved by SQL queries. It describes using the WHERE clause to restrict rows selected and comparison operators like =, <, and BETWEEN to define conditions. The ORDER BY clause allows sorting retrieved rows in ascending or descending order based on column values. Logical operators like AND, OR, and NOT can combine conditions.
This document provides an overview of basic SQL statements and concepts. It begins with objectives and aims of the lesson, which are to extract data from a database using SQL SELECT statements and to perform actions like restricting columns. It then covers the capabilities and components of SELECT statements like selection, projection, and joins. Examples are provided of basic SELECT statements to retrieve all or specific columns from a table. The document also discusses column headings, arithmetic expressions, operator precedence, null values, and defining column aliases.
This document introduces relational databases and Oracle's implementation. It describes how relational databases use tables and relations managed through SQL. It also explains that Oracle adds object-oriented capabilities and PL/SQL, an extension of SQL that integrates procedural logic. Finally, it overviews how PL/SQL code is executed within Oracle's environment.
This document discusses single-row functions in SQL. It describes various types of single-row functions including character, number, date, and conversion functions. Character functions manipulate character strings, number functions perform calculations on numbers, and date functions work with dates. Conversion functions explicitly convert between datatypes. Examples are provided to demonstrate how to use these functions in SELECT statements.
The document discusses database systems and provides an overview of key concepts. It begins with a brief history of databases, from early file-based systems to modern relational databases. It then defines what a database is, the components of a database system including data, software, hardware and users. The roles of different database users are identified. Database management systems are introduced as the software that allows users to store, organize, update and protect data.
Global Situational Awareness of A.I. and where its headedvikram sood
You can see the future first in San Francisco.
Over the past year, the talk of the town has shifted from $10 billion compute clusters to $100 billion clusters to trillion-dollar clusters. Every six months another zero is added to the boardroom plans. Behind the scenes, there’s a fierce scramble to secure every power contract still available for the rest of the decade, every voltage transformer that can possibly be procured. American big business is gearing up to pour trillions of dollars into a long-unseen mobilization of American industrial might. By the end of the decade, American electricity production will have grown tens of percent; from the shale fields of Pennsylvania to the solar farms of Nevada, hundreds of millions of GPUs will hum.
The AGI race has begun. We are building machines that can think and reason. By 2025/26, these machines will outpace college graduates. By the end of the decade, they will be smarter than you or I; we will have superintelligence, in the true sense of the word. Along the way, national security forces not seen in half a century will be un-leashed, and before long, The Project will be on. If we’re lucky, we’ll be in an all-out race with the CCP; if we’re unlucky, an all-out war.
Everyone is now talking about AI, but few have the faintest glimmer of what is about to hit them. Nvidia analysts still think 2024 might be close to the peak. Mainstream pundits are stuck on the wilful blindness of “it’s just predicting the next word”. They see only hype and business-as-usual; at most they entertain another internet-scale technological change.
Before long, the world will wake up. But right now, there are perhaps a few hundred people, most of them in San Francisco and the AI labs, that have situational awareness. Through whatever peculiar forces of fate, I have found myself amongst them. A few years ago, these people were derided as crazy—but they trusted the trendlines, which allowed them to correctly predict the AI advances of the past few years. Whether these people are also right about the next few years remains to be seen. But these are very smart people—the smartest people I have ever met—and they are the ones building this technology. Perhaps they will be an odd footnote in history, or perhaps they will go down in history like Szilard and Oppenheimer and Teller. If they are seeing the future even close to correctly, we are in for a wild ride.
Let me tell you what we see.
The Building Blocks of QuestDB, a Time Series Databasejavier ramirez
Talk Delivered at Valencia Codes Meetup 2024-06.
Traditionally, databases have treated timestamps just as another data type. However, when performing real-time analytics, timestamps should be first class citizens and we need rich time semantics to get the most out of our data. We also need to deal with ever growing datasets while keeping performant, which is as fun as it sounds.
It is no wonder time-series databases are now more popular than ever before. Join me in this session to learn about the internal architecture and building blocks of QuestDB, an open source time-series database designed for speed. We will also review a history of some of the changes we have gone over the past two years to deal with late and unordered data, non-blocking writes, read-replicas, or faster batch ingestion.
Learn SQL from basic queries to Advance queriesmanishkhaire30
Dive into the world of data analysis with our comprehensive guide on mastering SQL! This presentation offers a practical approach to learning SQL, focusing on real-world applications and hands-on practice. Whether you're a beginner or looking to sharpen your skills, this guide provides the tools you need to extract, analyze, and interpret data effectively.
Key Highlights:
Foundations of SQL: Understand the basics of SQL, including data retrieval, filtering, and aggregation.
Advanced Queries: Learn to craft complex queries to uncover deep insights from your data.
Data Trends and Patterns: Discover how to identify and interpret trends and patterns in your datasets.
Practical Examples: Follow step-by-step examples to apply SQL techniques in real-world scenarios.
Actionable Insights: Gain the skills to derive actionable insights that drive informed decision-making.
Join us on this journey to enhance your data analysis capabilities and unlock the full potential of SQL. Perfect for data enthusiasts, analysts, and anyone eager to harness the power of data!
#DataAnalysis #SQL #LearningSQL #DataInsights #DataScience #Analytics
Natural Language Processing (NLP), RAG and its applications .pptxfkyes25
1. In the realm of Natural Language Processing (NLP), knowledge-intensive tasks such as question answering, fact verification, and open-domain dialogue generation require the integration of vast and up-to-date information. Traditional neural models, though powerful, struggle with encoding all necessary knowledge within their parameters, leading to limitations in generalization and scalability. The paper "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks" introduces RAG (Retrieval-Augmented Generation), a novel framework that synergizes retrieval mechanisms with generative models, enhancing performance by dynamically incorporating external knowledge during inference.
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data LakeWalaa Eldin Moustafa
Dynamic policy enforcement is becoming an increasingly important topic in today’s world where data privacy and compliance is a top priority for companies, individuals, and regulators alike. In these slides, we discuss how LinkedIn implements a powerful dynamic policy enforcement engine, called ViewShift, and integrates it within its data lake. We show the query engine architecture and how catalog implementations can automatically route table resolutions to compliance-enforcing SQL views. Such views have a set of very interesting properties: (1) They are auto-generated from declarative data annotations. (2) They respect user-level consent and preferences (3) They are context-aware, encoding a different set of transformations for different use cases (4) They are portable; while the SQL logic is only implemented in one SQL dialect, it is accessible in all engines.
#SQL #Views #Privacy #Compliance #DataLake
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...sameer shah
"Join us for STATATHON, a dynamic 2-day event dedicated to exploring statistical knowledge and its real-world applications. From theory to practice, participants engage in intensive learning sessions, workshops, and challenges, fostering a deeper understanding of statistical methodologies and their significance in various fields."
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...Social Samosa
The Modern Marketing Reckoner (MMR) is a comprehensive resource packed with POVs from 60+ industry leaders on how AI is transforming the 4 key pillars of marketing – product, place, price and promotions.
Influence of Marketing Strategy and Market Competition on Business Plan
Les01.pptx
1. Copyright Oracle Corporation, 1998. All rights reserved.
1
Writing Basic
SQL Statements
2. 1-2 Copyright Oracle Corporation, 1998. All rights reserved.
Objectives
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 SQL*Plus commands
3. 1-3 Copyright Oracle Corporation, 1998. All rights reserved.
Capabilities of SQL SELECT
Statements
Selection Projection
Table 1 Table 2
Table 1 Table 1
Join
4. 1-4 Copyright Oracle Corporation, 1998. All rights reserved.
Basic SELECT Statement
SELECT [DISTINCT] {*, column [alias],...}
FROM table;
• SELECT identifies what columns.
• FROM identifies which table.
5. 1-5 Copyright Oracle Corporation, 1998. All rights reserved.
Writing SQL Statements
• SQL statements are not case sensitive.
• SQL statements can be on one or
more lines.
• Keywords cannot be abbreviated or
split across lines.
• Clauses are usually placed on separate
lines.
• Tabs and indents are used to enhance
readability.
6. 1-6 Copyright Oracle Corporation, 1998. All rights reserved.
Selecting All Columns
DEPTNO DNAME LOC
--------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> SELECT *
2 FROM dept;
7. 1-7 Copyright Oracle Corporation, 1998. All rights reserved.
Selecting Specific Columns
DEPTNO LOC
--------- -------------
10 NEW YORK
20 DALLAS
30 CHICAGO
40 BOSTON
SQL> SELECT deptno, loc
2 FROM dept;
8. 1-8 Copyright Oracle Corporation, 1998. All rights reserved.
Column Heading Defaults
• Default justification
– Left: Date and character data
– Right: Numeric data
• Default display: Uppercase
9. 1-9 Copyright Oracle Corporation, 1998. All rights reserved.
Arithmetic Expressions
Create expressions on NUMBER and DATE
data by using arithmetic operators.
Operator
+
-
*
/
Description
Add
Subtract
Multiply
Divide
10. 1-10 Copyright Oracle Corporation, 1998. All rights reserved.
Using Arithmetic Operators
SQL> SELECT ename, sal, sal+300
2 FROM emp;
ENAME SAL SAL+300
---------- --------- ---------
KING 5000 5300
BLAKE 2850 3150
CLARK 2450 2750
JONES 2975 3275
MARTIN 1250 1550
ALLEN 1600 1900
...
14 rows selected.
11. 1-11 Copyright Oracle Corporation, 1998. All rights reserved.
Operator Precedence
• Multiplication and division take priority
over addition and subtraction.
• Operators of the same priority are
evaluated from left to right.
• Parentheses are used to force
prioritized evaluation and to clarify
statements.
* / + _
12. 1-12 Copyright Oracle Corporation, 1998. All rights reserved.
Operator Precedence
SQL> SELECT ename, sal, 12*sal+100
2 FROM emp;
ENAME SAL 12*SAL+100
---------- --------- ----------
KING 5000 60100
BLAKE 2850 34300
CLARK 2450 29500
JONES 2975 35800
MARTIN 1250 15100
ALLEN 1600 19300
...
14 rows selected.
13. 1-13 Copyright Oracle Corporation, 1998. All rights reserved.
Using Parentheses
SQL> SELECT ename, sal, 12*(sal+100)
2 FROM emp;
ENAME SAL 12*(SAL+100)
---------- --------- -----------
KING 5000 61200
BLAKE 2850 35400
CLARK 2450 30600
JONES 2975 36900
MARTIN 1250 16200
...
14 rows selected.
14. 1-14 Copyright Oracle Corporation, 1998. All rights reserved.
Defining a Null Value
• A null is a value that is unavailable,
unassigned, unknown, or inapplicable.
• A null is not the same as zero or a blank
space.
SQL> SELECT ename, job, comm
2 FROM emp;
ENAME JOB COMM
---------- --------- ---------
KING PRESIDENT
BLAKE MANAGER
...
TURNER SALESMAN 0
...
14 rows selected.
15. 1-15 Copyright Oracle Corporation, 1998. All rights reserved.
Null Values
in Arithmetic Expressions
Arithmetic expressions containing a null
value evaluate to null.
SQL> select ename, 12*sal+comm
2 from emp
3 WHERE ename='KING';
ENAME 12*SAL+COMM
---------- -----------
KING
16. 1-16 Copyright Oracle Corporation, 1998. All rights reserved.
Defining a Column Alias
• Renames a column heading
• Is useful with calculations
• Immediately follows column name;
optional AS keyword between column
name and alias
• Requires double quotation marks if it
contains spaces or special characters
or is case sensitive
17. 1-17 Copyright Oracle Corporation, 1998. All rights reserved.
Using Column Aliases
SQL> SELECT ename AS name, sal salary
2 FROM emp;
NAME SALARY
------------- ---------
...
SQL> SELECT ename "Name",
2 sal*12 "Annual Salary"
3 FROM emp;
Name Annual Salary
------------- -------------
...
18. 1-18 Copyright Oracle Corporation, 1998. All rights reserved.
Concatenation Operator
• Concatenates columns or character
strings to other columns
• Is represented by two vertical bars (||)
• Creates a resultant column that is a
character expression
19. 1-19 Copyright Oracle Corporation, 1998. All rights reserved.
Using the Concatenation
Operator
SQL> SELECT ename||job AS "Employees"
2 FROM emp;
Employees
-------------------
KINGPRESIDENT
BLAKEMANAGER
CLARKMANAGER
JONESMANAGER
MARTINSALESMAN
ALLENSALESMAN
...
14 rows selected.
20. 1-20 Copyright Oracle Corporation, 1998. All rights reserved.
Literal Character Strings
• A literal is a character, expression, or
number included in the SELECT list.
• Date and character literal values must
be enclosed within single quotation
marks.
• Each character string is output once for
each row returned.
21. 1-21 Copyright Oracle Corporation, 1998. All rights reserved.
Using Literal Character Strings
Employee Details
-------------------------
KING is a PRESIDENT
BLAKE is a MANAGER
CLARK is a MANAGER
JONES is a MANAGER
MARTIN is a SALESMAN
...
14 rows selected.
SQL> SELECT ename ||' '||'is a'||' '||job
2 AS "Employee Details"
3 FROM emp;
22. 1-22 Copyright Oracle Corporation, 1998. All rights reserved.
Duplicate Rows
The default display of queries is all rows,
including duplicate rows.
SQL> SELECT deptno
2 FROM emp;
DEPTNO
---------
10
30
10
20
...
14 rows selected.
23. 1-23 Copyright Oracle Corporation, 1998. All rights reserved.
Eliminating Duplicate Rows
Eliminate duplicate rows by using the
DISTINCT keyword in the SELECT clause.
SQL> SELECT DISTINCT deptno
2 FROM emp;
DEPTNO
---------
10
20
30
24. 1-24 Copyright Oracle Corporation, 1998. All rights reserved.
SQL and SQL*Plus Interaction
SQL*Plus
SQL Statements
Buffer
SQL Statements
Server
Query Results
SQL*Plus
Commands
Formatted Report
25. 1-25 Copyright Oracle Corporation, 1998. All rights reserved.
SQL Statements Versus
SQL*Plus Commands
SQL
statements
SQL
• A language
• ANSI standard
• Keyword cannot be
abbreviated
• Statements manipulate
data and table
definitions in the
database
SQL*Plus
• An environment
• Oracle proprietary
• Keywords can be
abbreviated
• Commands do not
allow manipulation of
values in the database
SQL
buffer
SQL*Plus
commands
SQL*Plus
buffer
26. 1-26 Copyright Oracle Corporation, 1998. All rights reserved.
• Log in to SQL*Plus.
• Describe the table structure.
• Edit your SQL statement.
• Execute SQL from SQL*Plus.
• Save SQL statements to files and
append SQL statements to files.
• Execute saved files.
• Load commands from file to buffer
to edit.
Overview of SQL*Plus
27. 1-27 Copyright Oracle Corporation, 1998. All rights reserved.
Logging In to SQL*Plus
• From Windows environment:
• From command line:
sqlplus [username[/password
[@database]]]
28. 1-28 Copyright Oracle Corporation, 1998. All rights reserved.
Displaying Table Structure
Use the SQL*Plus DESCRIBE command to
display the structure of a table.
DESC[RIBE] tablename
29. 1-29 Copyright Oracle Corporation, 1998. All rights reserved.
Displaying Table Structure
SQL> DESCRIBE dept
Name Null? Type
----------------- -------- ------------
DEPTNO NOT NULL NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)
30. 1-30 Copyright Oracle Corporation, 1998. All rights reserved.
SQL*Plus Editing Commands
• A[PPEND] text
• C[HANGE] / old / new
• C[HANGE] / text /
• CL[EAR] BUFF[ER]
• DEL
• DEL n
• DEL m n
31. 1-31 Copyright Oracle Corporation, 1998. All rights reserved.
SQL*Plus Editing Commands
• I[NPUT]
• I[NPUT] text
• L[IST]
• L[IST] n
• L[IST] m n
• R[UN]
• n
• n text
• 0 text
32. 1-32 Copyright Oracle Corporation, 1998. All rights reserved.
SQL*Plus File Commands
• SAVE filename
• GET filename
• START filename
• @ filename
• EDIT filename
• SPOOL filename
33. 1-33 Copyright Oracle Corporation, 1998. All rights reserved.
Summary
Use SQL*Plus as an environment to:
• Execute SQL statements
• Edit SQL statements
SELECT [DISTINCT] {*,column [alias],...}
FROM table;
34. 1-34 Copyright Oracle Corporation, 1998. All rights reserved.
Practice Overview
• Selecting all data from different tables
• Describing the structure of tables
• Performing arithmetic calculations and
specifying column names
• Using SQL*Plus editor