SlideShare a Scribd company logo
Basic   SELECT   Statement  http://ecomputernotes.com
"  "  http://ecomputernotes.com Basic   SELECT   Statement  SELECT  * |   { [DISTINCT]   column | expression   [ alias ],...}  FRO M  table;  SELECT   identifies   what   columns  FROM   identifies   which   table
http://ecomputernotes.com Selecting All Columns  SELECT *  FROM  departments;
Selecting Specific Columns  SELECT department_id, location_id  FROM  departments;  http://ecomputernotes.com
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.  "  Indents are used to enhance readability.  http://ecomputernotes.com
Column Heading Defaults  "  i SQL*Plus:  Default heading justification: Center Default heading display: Uppercase  "  SQL*Plus:  Character and Date column headings are left- justified  Number column headings are right-justified Default heading display: Uppercase  http://ecomputernotes.com
Arithmetic Expressions  Create expressions with number and date data by  using arithmetic operators.  Operator  Description  +  Add  -  Subtract  *  Multiply  /  Divide  http://ecomputernotes.com
Using Arithmetic Operators  SELECT last_name, salary, salary + 300  FROM  employees;  «  http://ecomputernotes.com
Operator Precedence  _  /  +  *  "M ultiplication and division take priority over  addition and subtraction.  "O perators of the same priority are evaluated from  left to right.  "P arentheses are used to force prioritized  evaluation and to clarify statements.  http://ecomputernotes.com
Operator Precedence  SELECT last_name, salary, 12*salary+100  FROM  employees;  «  http://ecomputernotes.com
Using Parentheses  SELECT last_name, salary, 12*(salary+100)  FROM  employees;  «
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.  SELECT last_name, job_id, salary, commission_pct  FROM  employees;  «  «
Null Values  in Arithmetic Expressions  Arithmetic expressions containing a null value  evaluate to null.  SELECT last_name, 12*salary*commission_pct  FROM  employees;  «  «
Defining a Column Alias  A column alias:  "  Renames a column heading  "  Is useful with calculations  "  Immediately follows the column name - there can  also be the optional   AS   keyword between the column name and alias  "R equires double quotation marks if it contains  spaces or special characters or is case sensitive
Using Column Aliases  SELECT last_name AS name, commission_pct comm  FROM  employees;  «  SELECT last_name "Name", salary*12 "Annual Salary"  FROM  employees;  «
Concatenation Operator  A 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
Using the Concatenation Operator  SELECT  last_name||job_id AS "Employees"  FRO M  employees;  «
Literal Character Strings  "A  literal is a character, a number, or a date  included in the   SELECT   list.  "D ate and character literal values must be enclosed  within single quotation marks.  "E ach character string is output once for each  row returned.
Using Literal Character Strings  SELECT last_name  ||' is a '||job_id  AS "Employee Details"  FROM  employees;  «
Duplicate Rows  The default display of queries is all rows, including  duplicate rows.  SELECT department_id  FROM  employees;  «
Eliminating Duplicate Rows  Eliminate duplicate rows by using the   DISTINCT keyword in the   SELECT   clause.  SELECT DISTINCT department_id FROM  employees;
Displaying Table Structure  DESCRIBE employees
 

More Related Content

PPT
PPT
PPTX
Form Validation in JavaScript
DOCX
Excel
PPTX
C# XML documentation
PPTX
Excel error
DOCX
management
PPT
SQL select statement and functions
Form Validation in JavaScript
Excel
C# XML documentation
Excel error
management
SQL select statement and functions

What's hot (20)

PPT
Using single row functions to customize output
PPT
Les01 (retrieving data using the sql select statement)
PPT
Sql server select queries ppt 18
PPTX
Javascript validating form
PPT
Retrieving data using the sql select statement
PPTX
Oracle: Basic SQL
PPTX
1. dml select statement reterive data
PPTX
Beginers guide for oracle sql
PPTX
Understanding excel’s error values
PPTX
Formula in MS Excel
PPT
PDF
TrainingOutline_Excel_FormulasNFunctions_Workshop (Writing Sample)
PDF
Introduction to programming c and data-structures
PPT
SQL subquery
PDF
Operators in c programming
PDF
Row, Column, Index, Match, Offset Functions. Excel Tutorial
PPTX
Using Excel Functions
PDF
On if,countif,countifs,sumif,countifs,lookup,v lookup,index,match
PPTX
10 Excel Formulas that will help you in any Job
Using single row functions to customize output
Les01 (retrieving data using the sql select statement)
Sql server select queries ppt 18
Javascript validating form
Retrieving data using the sql select statement
Oracle: Basic SQL
1. dml select statement reterive data
Beginers guide for oracle sql
Understanding excel’s error values
Formula in MS Excel
TrainingOutline_Excel_FormulasNFunctions_Workshop (Writing Sample)
Introduction to programming c and data-structures
SQL subquery
Operators in c programming
Row, Column, Index, Match, Offset Functions. Excel Tutorial
Using Excel Functions
On if,countif,countifs,sumif,countifs,lookup,v lookup,index,match
10 Excel Formulas that will help you in any Job
Ad

Similar to e computer notes - Writing basic sql select statements (20)

PPT
Les01-Oracle
PPTX
CHAPTER 1 BASIC sql STATEMENTS.pptx
PPTX
Ch 1 Basic SQL Statement for the data.pptx
PPT
Chinabankppt
PPT
Day1_SQL_1 for learning about sql cldarly.ppt
PPT
Sql statments c ha p# 1
PPTX
Basic SQL Statments
PDF
Basic Sql Handouts
PPT
PPT
Basic sql statements
PPT
PPT
Select To Order By
PPT
SQL- Introduction to MySQL
PDF
Basic sqlstatements
PPT
SQL, consultas rapidas y sencillas, oracle
PPT
The Basic of Standard Query Language Statements.ppt
PPT
ALL ABOUT SQL AND RDBMS
PDF
Basic sqlstatements
PPT
01 basic orders
Les01-Oracle
CHAPTER 1 BASIC sql STATEMENTS.pptx
Ch 1 Basic SQL Statement for the data.pptx
Chinabankppt
Day1_SQL_1 for learning about sql cldarly.ppt
Sql statments c ha p# 1
Basic SQL Statments
Basic Sql Handouts
Basic sql statements
Select To Order By
SQL- Introduction to MySQL
Basic sqlstatements
SQL, consultas rapidas y sencillas, oracle
The Basic of Standard Query Language Statements.ppt
ALL ABOUT SQL AND RDBMS
Basic sqlstatements
01 basic orders
Ad

More from ecomputernotes (20)

PPT
computer notes - Data Structures - 30
PPT
computer notes - Data Structures - 39
PPT
computer notes - Data Structures - 11
PPT
computer notes - Data Structures - 20
PPT
computer notes - Data Structures - 15
DOC
Computer notes - Including Constraints
DOC
Computer notes - Date time Functions
DOC
Computer notes - Subqueries
DOC
Computer notes - Other Database Objects
PPT
computer notes - Data Structures - 28
PPT
computer notes - Data Structures - 19
PPT
computer notes - Data Structures - 31
PPT
computer notes - Data Structures - 4
PPT
computer notes - Data Structures - 13
DOC
Computer notes - Advanced Subqueries
DOC
Computer notes - Aggregating Data Using Group Functions
PPT
computer notes - Data Structures - 16
PPT
computer notes - Data Structures - 22
PPT
computer notes - Data Structures - 35
PPT
computer notes - Data Structures - 36
computer notes - Data Structures - 30
computer notes - Data Structures - 39
computer notes - Data Structures - 11
computer notes - Data Structures - 20
computer notes - Data Structures - 15
Computer notes - Including Constraints
Computer notes - Date time Functions
Computer notes - Subqueries
Computer notes - Other Database Objects
computer notes - Data Structures - 28
computer notes - Data Structures - 19
computer notes - Data Structures - 31
computer notes - Data Structures - 4
computer notes - Data Structures - 13
Computer notes - Advanced Subqueries
Computer notes - Aggregating Data Using Group Functions
computer notes - Data Structures - 16
computer notes - Data Structures - 22
computer notes - Data Structures - 35
computer notes - Data Structures - 36

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
KodekX | Application Modernization Development
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPT
Teaching material agriculture food technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Electronic commerce courselecture one. Pdf
PDF
Advanced IT Governance
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Cloud computing and distributed systems.
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
“AI and Expert System Decision Support & Business Intelligence Systems”
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Network Security Unit 5.pdf for BCA BBA.
KodekX | Application Modernization Development
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Teaching material agriculture food technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
The AUB Centre for AI in Media Proposal.docx
Electronic commerce courselecture one. Pdf
Advanced IT Governance
Reach Out and Touch Someone: Haptics and Empathic Computing
Unlocking AI with Model Context Protocol (MCP)
Big Data Technologies - Introduction.pptx
Cloud computing and distributed systems.
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...

e computer notes - Writing basic sql select statements

  • 1. Basic SELECT Statement http://ecomputernotes.com
  • 2. " " http://ecomputernotes.com Basic SELECT Statement SELECT * | { [DISTINCT] column | expression [ alias ],...} FRO M table; SELECT identifies what columns FROM identifies which table
  • 4. Selecting Specific Columns SELECT department_id, location_id FROM departments; http://ecomputernotes.com
  • 5. 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. " Indents are used to enhance readability. http://ecomputernotes.com
  • 6. Column Heading Defaults " i SQL*Plus: Default heading justification: Center Default heading display: Uppercase " SQL*Plus: Character and Date column headings are left- justified Number column headings are right-justified Default heading display: Uppercase http://ecomputernotes.com
  • 7. Arithmetic Expressions Create expressions with number and date data by using arithmetic operators. Operator Description + Add - Subtract * Multiply / Divide http://ecomputernotes.com
  • 8. Using Arithmetic Operators SELECT last_name, salary, salary + 300 FROM employees; « http://ecomputernotes.com
  • 9. Operator Precedence _ / + * "M ultiplication and division take priority over addition and subtraction. "O perators of the same priority are evaluated from left to right. "P arentheses are used to force prioritized evaluation and to clarify statements. http://ecomputernotes.com
  • 10. Operator Precedence SELECT last_name, salary, 12*salary+100 FROM employees; « http://ecomputernotes.com
  • 11. Using Parentheses SELECT last_name, salary, 12*(salary+100) FROM employees; «
  • 12. 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. SELECT last_name, job_id, salary, commission_pct FROM employees; « «
  • 13. Null Values in Arithmetic Expressions Arithmetic expressions containing a null value evaluate to null. SELECT last_name, 12*salary*commission_pct FROM employees; « «
  • 14. Defining a Column Alias A column alias: " Renames a column heading " Is useful with calculations " Immediately follows the column name - there can also be the optional AS keyword between the column name and alias "R equires double quotation marks if it contains spaces or special characters or is case sensitive
  • 15. Using Column Aliases SELECT last_name AS name, commission_pct comm FROM employees; « SELECT last_name "Name", salary*12 "Annual Salary" FROM employees; «
  • 16. Concatenation Operator A 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
  • 17. Using the Concatenation Operator SELECT last_name||job_id AS "Employees" FRO M employees; «
  • 18. Literal Character Strings "A literal is a character, a number, or a date included in the SELECT list. "D ate and character literal values must be enclosed within single quotation marks. "E ach character string is output once for each row returned.
  • 19. Using Literal Character Strings SELECT last_name ||' is a '||job_id AS "Employee Details" FROM employees; «
  • 20. Duplicate Rows The default display of queries is all rows, including duplicate rows. SELECT department_id FROM employees; «
  • 21. Eliminating Duplicate Rows Eliminate duplicate rows by using the DISTINCT keyword in the SELECT clause. SELECT DISTINCT department_id FROM employees;
  • 22. Displaying Table Structure DESCRIBE employees
  • 23.