SlideShare a Scribd company logo
1 of 23
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi




                                                cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

         SQL (Structured Query Language)
         Strukturlaşdırılmış Sorğu Dili

 Heç bir prosedura malik deyil.
 Sintaksisi olduqca rahat ve İnglis dilinə yaxındır.
 Məlumatların VB-də saxlanılmasının fizki forması haqqında biliklər tələb etmir.
 Məlumatların saxlanılmasının məntiqi quruluşu üzərinə orientasiya edilib.
 VBİS-lərdə məlumatları emal etmək üçün mövcud olan yeganə vasitədir.




                                                          cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

SQL Operatorları (SQL Statements)

SQL Operatorları 4 qrupa bölünür.

   DML (Data Manipulation Language)
   DDL (Data Definition Language)
   DCL (Data Control Language)
   TCL (Transaction Control Language)



                                                cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

DML - (Data Manipulation Language)

     SELECT
     INSERT
     UPDATE
     DELETE
     MERGE


                                                cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi


       DDL                    DCL                      TCL
 CREATE                 GRANT                  COMMIT
 ALTER                  REVOKE                 ROLLBACK
 DROP                                          SAVEPOINT
 RENAME
 TRUNCATE
 COMMENT

                                                cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

  Table structure                      COLUMN (ATTRIBUTE)


                                                                 ROW
                                                                 TUPLE




                                                cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

Capability of the SELECT statement
SELECT operatoru ORACLE tərəfindən üç müxtəlif konsepsiya əsasında icra edilir.

1. Projection (sütunların seçilməsi)      2. Selection (sətirlərin seçilməsi)




3. Joining ( iki və daha çox cədvəlin birləşdirilməsi)




                                                         cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

Bəsit SELECT sorğusu
   SELECT operatoru verilənlər bazasında yerləşən məlumatların üzə
çıxarılmasını təmin edir.

   SELECT operatoru ilə yaradılan sorğunun ən bəsit forması aşağıdakı
kimidir.

    SELECT *|{[DISTINCT] column|expression [alias],...}
    FROM    table;


  FROM üzə çıxarılacaq məlumatların aid olduğu cədvəlin adını göstərir.



                                                   cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

Bəsit SELECT sorğusu
SELECT * FROM table;
   * (asterisk) simvolu table cədvəlində mövcud olan bütün məlumatların,
yəni sütun və sətirlərin üzə çıxarılmasını təmin edir. Bu sorğu bəzən “blind
query” (kor sorğu) adlandırılır.

SELECT column1, column2 FROM table;

    Bu halda biz table cədvəlində mövcud olan bütün sütunların deyil, yalnız
bizə lazım olan sütunların üzə çıxarılmasını təmin edir.

    Oracle SQL – də ən bəsit SELECT sorğusu mütləq və mütləq FROM ifadəsi
ilə birlikdə işlədilir.


                                                     cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

Bəsit SELECT sorğusu
SELECT DISTINCT column1, column2 FROM table;
   DISTINCT açar sözü, SELECT operatorunun bir hissəsidir, üzə çıxarılan
məlumatların təkrarlanmasının qarşısını alır.

    Bir deyil, eyni zamanda bir neçə sütun adına tətbiq edilə bilər. Bu zaman sütünlar
ayrı-ayrılıqda təkrar oluna bilər, lakin oların kombinasiyası unikal olmalıdır.

SELECT job_id                        SELECT DISTNICT job_id
FROM employees;                      FROM employees;




                                                           cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

  Arithmetic Expressions (Riyazi ifadələr)

            Create expressions with number and date
               data by using arithmetic operators

               Operator                Description
                 +                        ADD
                   -                   SUBTRACT
                  *                    MULTIPLE
                  /                      DIVIDE

                                                cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

              Using Arithmetic Operators
       SELECT first_name, last_name, salary, salary + 300
       FROM   employees;




   Riyazi operatorlar müxtəlif üstünlük dərəcəsinə malikdirlər və ilk olaraq
üstünlüyü yüksək olan ifadələr hesablanır.

                                                     cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

Arithmetic Operators Precedence
      SELECT first_name, last_name, salary, 12*salary+100
      FROM   employees;




      SELECT first_name, last_name, salary, 12*(salary+100)
      FROM   employees;




                                                cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

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.
 By default, alias headings appear in uppercase.
 Requires double quotation marks if it contains spaces or special characters, or if it is case-
 sensitive
SELECT first_name, last_name, salary, 12*salary+100   SELECT last_name, salary, 12*salary+100 AS "Annual Salary"
FROM   employees;                                     FROM   employees;




                                                                        cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

Bəsit SELECT sorğusu
SELECT *|{[DISTINCT] column|expression [alias],...}
FROM table;
  SELECT - Seçim operatoru
  * - mövcud olan bütün cədvəlləri ifadə edir
  DISTINCT - təkrarların aradan qaldırılmasını təmin edir
  column - cədvəldə olan sütun adı.
  expression - cədvəldə mövcud olmayan, riyazi əməliyyatlar nəticəsində yaranan
   vizual sütunlar.
  alias – cədvəllərə verilən ad.
  FROM – açar sözü, SELECT operatorunun bir hissəsidir, məlumatın yerləşdiyi cədvəl
  adını göstərir.
 table – xaric etdiyimiz məlumatların yerləşdiyi cədvəlin adı.


                                                            cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

 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
    SQL statements must be terminated by a semicolon (;)




                                                cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

The DESCRIBE command
    Oracle server stores information about all tables in a special set of relational
tables called the data dictionary. This information is also referred to as metadata.

   The contents of a table are stored in rows and are referred to as data.

   The structural metadata of a table may be obtained using DESCRIBE command.

   The general form of the syntax is: DESC[RIBE] <SCHEMA>.tablename;

    If describing table belongs to the connected schema, the <SCHEMA> portion of
the command may be omitted.


                                                           cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

Data types
NUMBER(p,s)        Numeric data, first parameter is precision, the second is scale.

VARCHAR2(length)   Variable length alphanumeric character.

CHAR(size)         Fixed-length alphanumeric character.

DATE               Stores a moment in time with precision including day, month,
                   years, hours, minutes and seconds.




                                                       cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

NULL is nothing
  Null is a value that is unavailable, unassigned, unknown, or inapplicable.
  Null is not the same as zero or a blank space.
       SELECT first_name, last_name, department_id, job_id, salary, commission_pct
       FROM   employees;




                                                              cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

NULL values in arithmetic expressions
  Arithmetic expressions containing a null value always evaluate to null.

 SELECT first_name, last_name, salary, commission_pct, salary * commission_pct AS comission
 FROM   employees;




                                                              cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

Concatenation Operator ||
  Links columns or character strings to other columns
  Is represented by two vertical bars (||)
  Creates a resultant column that is a character expression

     SELECT first_name || last_name AS "Employees" FROM employees;




                                                        cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

Literal character strings
 A literal is a character, a number, or a date that is included in the
 SELECT statement.

 Date and character literal values must be enclosed within single
 quotation marks.

 Each character string is output once for each row returned.



                                                 cavidhasanov.wordpress.com
Dərs 1
SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi

Quote (q) Operator
   Specify your own quotation mark delimiter.
   Select any delimiter.
   Increase readability and usability.

     SELECT department_name || q'[ Department's Manager Id is: ]'
     || manager_id AS "Department and Manager"
     FROM departments;



                                     q‘delimiter LITERAL delimiter'



                                                  cavidhasanov.wordpress.com

More Related Content

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Oracle SQL Basic SELECT Statement

  • 1. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi cavidhasanov.wordpress.com
  • 2. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi SQL (Structured Query Language) Strukturlaşdırılmış Sorğu Dili Heç bir prosedura malik deyil. Sintaksisi olduqca rahat ve İnglis dilinə yaxındır. Məlumatların VB-də saxlanılmasının fizki forması haqqında biliklər tələb etmir. Məlumatların saxlanılmasının məntiqi quruluşu üzərinə orientasiya edilib. VBİS-lərdə məlumatları emal etmək üçün mövcud olan yeganə vasitədir. cavidhasanov.wordpress.com
  • 3. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi SQL Operatorları (SQL Statements) SQL Operatorları 4 qrupa bölünür. DML (Data Manipulation Language) DDL (Data Definition Language) DCL (Data Control Language) TCL (Transaction Control Language) cavidhasanov.wordpress.com
  • 4. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi DML - (Data Manipulation Language) SELECT INSERT UPDATE DELETE MERGE cavidhasanov.wordpress.com
  • 5. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi DDL DCL TCL CREATE GRANT COMMIT ALTER REVOKE ROLLBACK DROP SAVEPOINT RENAME TRUNCATE COMMENT cavidhasanov.wordpress.com
  • 6. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi Table structure COLUMN (ATTRIBUTE) ROW TUPLE cavidhasanov.wordpress.com
  • 7. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi Capability of the SELECT statement SELECT operatoru ORACLE tərəfindən üç müxtəlif konsepsiya əsasında icra edilir. 1. Projection (sütunların seçilməsi) 2. Selection (sətirlərin seçilməsi) 3. Joining ( iki və daha çox cədvəlin birləşdirilməsi) cavidhasanov.wordpress.com
  • 8. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi Bəsit SELECT sorğusu SELECT operatoru verilənlər bazasında yerləşən məlumatların üzə çıxarılmasını təmin edir. SELECT operatoru ilə yaradılan sorğunun ən bəsit forması aşağıdakı kimidir. SELECT *|{[DISTINCT] column|expression [alias],...} FROM table; FROM üzə çıxarılacaq məlumatların aid olduğu cədvəlin adını göstərir. cavidhasanov.wordpress.com
  • 9. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi Bəsit SELECT sorğusu SELECT * FROM table; * (asterisk) simvolu table cədvəlində mövcud olan bütün məlumatların, yəni sütun və sətirlərin üzə çıxarılmasını təmin edir. Bu sorğu bəzən “blind query” (kor sorğu) adlandırılır. SELECT column1, column2 FROM table; Bu halda biz table cədvəlində mövcud olan bütün sütunların deyil, yalnız bizə lazım olan sütunların üzə çıxarılmasını təmin edir. Oracle SQL – də ən bəsit SELECT sorğusu mütləq və mütləq FROM ifadəsi ilə birlikdə işlədilir. cavidhasanov.wordpress.com
  • 10. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi Bəsit SELECT sorğusu SELECT DISTINCT column1, column2 FROM table; DISTINCT açar sözü, SELECT operatorunun bir hissəsidir, üzə çıxarılan məlumatların təkrarlanmasının qarşısını alır. Bir deyil, eyni zamanda bir neçə sütun adına tətbiq edilə bilər. Bu zaman sütünlar ayrı-ayrılıqda təkrar oluna bilər, lakin oların kombinasiyası unikal olmalıdır. SELECT job_id SELECT DISTNICT job_id FROM employees; FROM employees; cavidhasanov.wordpress.com
  • 11. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi Arithmetic Expressions (Riyazi ifadələr) Create expressions with number and date data by using arithmetic operators Operator Description + ADD - SUBTRACT * MULTIPLE / DIVIDE cavidhasanov.wordpress.com
  • 12. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi Using Arithmetic Operators SELECT first_name, last_name, salary, salary + 300 FROM employees; Riyazi operatorlar müxtəlif üstünlük dərəcəsinə malikdirlər və ilk olaraq üstünlüyü yüksək olan ifadələr hesablanır. cavidhasanov.wordpress.com
  • 13. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi Arithmetic Operators Precedence SELECT first_name, last_name, salary, 12*salary+100 FROM employees; SELECT first_name, last_name, salary, 12*(salary+100) FROM employees; cavidhasanov.wordpress.com
  • 14. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi 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. By default, alias headings appear in uppercase. Requires double quotation marks if it contains spaces or special characters, or if it is case- sensitive SELECT first_name, last_name, salary, 12*salary+100 SELECT last_name, salary, 12*salary+100 AS "Annual Salary" FROM employees; FROM employees; cavidhasanov.wordpress.com
  • 15. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi Bəsit SELECT sorğusu SELECT *|{[DISTINCT] column|expression [alias],...} FROM table; SELECT - Seçim operatoru * - mövcud olan bütün cədvəlləri ifadə edir DISTINCT - təkrarların aradan qaldırılmasını təmin edir column - cədvəldə olan sütun adı. expression - cədvəldə mövcud olmayan, riyazi əməliyyatlar nəticəsində yaranan vizual sütunlar. alias – cədvəllərə verilən ad. FROM – açar sözü, SELECT operatorunun bir hissəsidir, məlumatın yerləşdiyi cədvəl adını göstərir. table – xaric etdiyimiz məlumatların yerləşdiyi cədvəlin adı. cavidhasanov.wordpress.com
  • 16. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi 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 SQL statements must be terminated by a semicolon (;) cavidhasanov.wordpress.com
  • 17. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi The DESCRIBE command Oracle server stores information about all tables in a special set of relational tables called the data dictionary. This information is also referred to as metadata. The contents of a table are stored in rows and are referred to as data. The structural metadata of a table may be obtained using DESCRIBE command. The general form of the syntax is: DESC[RIBE] <SCHEMA>.tablename; If describing table belongs to the connected schema, the <SCHEMA> portion of the command may be omitted. cavidhasanov.wordpress.com
  • 18. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi Data types NUMBER(p,s) Numeric data, first parameter is precision, the second is scale. VARCHAR2(length) Variable length alphanumeric character. CHAR(size) Fixed-length alphanumeric character. DATE Stores a moment in time with precision including day, month, years, hours, minutes and seconds. cavidhasanov.wordpress.com
  • 19. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi NULL is nothing Null is a value that is unavailable, unassigned, unknown, or inapplicable. Null is not the same as zero or a blank space. SELECT first_name, last_name, department_id, job_id, salary, commission_pct FROM employees; cavidhasanov.wordpress.com
  • 20. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi NULL values in arithmetic expressions Arithmetic expressions containing a null value always evaluate to null. SELECT first_name, last_name, salary, commission_pct, salary * commission_pct AS comission FROM employees; cavidhasanov.wordpress.com
  • 21. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi Concatenation Operator || Links columns or character strings to other columns Is represented by two vertical bars (||) Creates a resultant column that is a character expression SELECT first_name || last_name AS "Employees" FROM employees; cavidhasanov.wordpress.com
  • 22. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi Literal character strings A literal is a character, a number, or a date that is included in the SELECT statement. Date and character literal values must be enclosed within single quotation marks. Each character string is output once for each row returned. cavidhasanov.wordpress.com
  • 23. Dərs 1 SQL dilinin sintaksisi və VBİS-lərdən məlumatların əldə edilməsi Quote (q) Operator Specify your own quotation mark delimiter. Select any delimiter. Increase readability and usability. SELECT department_name || q'[ Department's Manager Id is: ]' || manager_id AS "Department and Manager" FROM departments; q‘delimiter LITERAL delimiter' cavidhasanov.wordpress.com