SlideShare a Scribd company logo
1 of 17
 Collection of interrelated data
 Set of programs to access the data
 DBMS contains information about a particular enterprise
 DBMS provides an environment that is both convenient
and efficient to use.
 Database Applications:
 Banking: all transactions
 Airlines: reservations, schedules
 Universities: registration, grades
 Sales: customers, products, purchases
 Manufacturing: production, inventory, orders, supply chain
 Human resources: employee records, salaries, tax deductions
 Databases touch all aspects of our lives
What is SQL?
– When a user wants to get some
information from a database file, he
can issue a query.
1
– A query is a user–request to retrieve
data or information with a certain
condition.
– SQL is a query language that allows user
to specify the conditions. (instead of
algorithms)
Concept of SQL
– The user specifies a certain condition.
1
– The result of the query will then be
stored in form of a table.
– Statistical information of the data.
– The program will go through all the
records in the database file and select
those records that satisfy the
condition.(searching).
Both an ANSI and ISO standard
Types of commands:
1. Data Definition Language (DDL) : Create, Alter, Drop,
Rename, Truncate
2. Data Manipulation Language (DML): Insert, Delete,
Update
1. Data Retrieval: Select
2. Transaction Control: Commit, Rollback, Savepoint
3. Data Control Language (DCL): Grant, Revoke
5
A simplified schematic of a typical SQL
environment, as described by the SQL-2003
standard
6
 Catalog
 A set of schemas that constitute the description of a database
 Schema (or Database)
 The structure that contains descriptions of objects created by a user (base tables,
views, constraints)
 Data Definition Language (DDL)
 Commands that define a database, including creating, altering, and dropping tables and
establishing constraints
 Data Manipulation Language (DML)
 Commands that maintain and query a database
 Data Control Language (DCL)
 Commands that control a database, including administering privileges and committing data
CREATE TABLE {table}
( {column datatype [DEFAULT expr]
[column_constraint] ... | table_constraint}
[, { column datatype [DEFAULT expr]
[column_constraint] ...
)
ALTER TABLE {table}
[ADD|MODIFY {column datatype [DEFAULT expr] [column_constraint]}
[DROP drop_clause]
DROP TABLE {table} [cascade constraints]
DESC {table}
INSERT INTO {table | view} [ (column [, column] ...) ]
VALUES (expr,expr ...)
UPDATE {table | view }
SET { (column [, column] = { expr | }
[WHERE condition]
DELETE [FROM] {table | view} [WHERE condition]
Data Retrieval:
SELECT [DISTINCT | ALL] {table|view}
FROM {table | view}
[WHERE condition ]
[GROUP BY expr [, expr]]
[ORDER BY {expr} [ASC | DESC]]
select * from dept;
select deptname from dept where deptid='10';
select lname,fname from emp order by lname desc;
select max(salary) from emp group by positionid;
select deptname from dept,emp where
dept.deptid=emp.deptid and emp.empid='111';
Transaction Control:
COMMIT
ROLLBACK [ to {savepoint}]
SAVEPOINT {name}
commit;
savepoint point1;
rollback to point1;
Data Control Language:
GRANT [privileges]
ON object TO user|public
[WITH GRANT OPTION]
REVOKE [privileges]
ON object TO user|public
[CASCADE CONSTRAINTS]
grant select,update on emp to XYZ ;
revoke update on emp to XYZ;
SelectionProjection
Table 1 Table 2
Table 1Table 1
Join
 SELECT identifies the columns to be displayed.
 FROM identifies the table containing those columns.
SELECT *|{[DISTINCT] column|expression [alias],...}
FROM table;
SELECT *
FROM departments;
SELECT department_id, location_id
FROM departments;
 SQL statements are not case-sensitive.
 SQL statements can be entered 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.
 In SQL Developer, SQL statements can optionally be
terminated by a semicolon (;). Semicolons are
required when you execute multiple SQL statements.
 In SQL*Plus, you are required to end each SQL
statement with a semicolon (;).

More Related Content

What's hot (20)

Database Architecture
Database ArchitectureDatabase Architecture
Database Architecture
 
Sql introduction
Sql introductionSql introduction
Sql introduction
 
1 ddl
1 ddl1 ddl
1 ddl
 
Data base
Data baseData base
Data base
 
Sql - Structured Query Language
Sql - Structured Query LanguageSql - Structured Query Language
Sql - Structured Query Language
 
What is SQL Server?
What is SQL Server?What is SQL Server?
What is SQL Server?
 
Sql
SqlSql
Sql
 
Structured Query Language
Structured Query LanguageStructured Query Language
Structured Query Language
 
Dml and ddl
Dml and ddlDml and ddl
Dml and ddl
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
Data definition language
Data definition languageData definition language
Data definition language
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 
PT- Oracle session01
PT- Oracle session01 PT- Oracle session01
PT- Oracle session01
 
Sql
SqlSql
Sql
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
Module02
Module02Module02
Module02
 
SQL: Structured Query Language
SQL: Structured Query LanguageSQL: Structured Query Language
SQL: Structured Query Language
 
Sql intro & ddl 1
Sql intro & ddl 1Sql intro & ddl 1
Sql intro & ddl 1
 
Data Ware Housing through SQL concept
Data Ware Housing through SQL conceptData Ware Housing through SQL concept
Data Ware Housing through SQL concept
 
DDL(Data defination Language ) Using Oracle
DDL(Data defination Language ) Using OracleDDL(Data defination Language ) Using Oracle
DDL(Data defination Language ) Using Oracle
 

Viewers also liked

Multiplexing ppt15 sep
Multiplexing ppt15 sepMultiplexing ppt15 sep
Multiplexing ppt15 sepSrashti Vyas
 
Common channel Signalling System No 7 ppt
Common channel Signalling System No 7 pptCommon channel Signalling System No 7 ppt
Common channel Signalling System No 7 pptSrashti Vyas
 
The Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsThe Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsBarry Feldman
 
The Outcome Economy
The Outcome EconomyThe Outcome Economy
The Outcome EconomyHelge Tennø
 

Viewers also liked (6)

Multiplexing ppt15 sep
Multiplexing ppt15 sepMultiplexing ppt15 sep
Multiplexing ppt15 sep
 
SPACE DIVISION MULTIPLEXING (SDMA)
SPACE DIVISION MULTIPLEXING (SDMA)SPACE DIVISION MULTIPLEXING (SDMA)
SPACE DIVISION MULTIPLEXING (SDMA)
 
Common channel Signalling System No 7 ppt
Common channel Signalling System No 7 pptCommon channel Signalling System No 7 ppt
Common channel Signalling System No 7 ppt
 
Signaling system 7 (ss7)
Signaling system 7 (ss7)Signaling system 7 (ss7)
Signaling system 7 (ss7)
 
The Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsThe Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post Formats
 
The Outcome Economy
The Outcome EconomyThe Outcome Economy
The Outcome Economy
 

Similar to SQLSlide

Database Management System (DBMS).pptx
Database Management System (DBMS).pptxDatabase Management System (DBMS).pptx
Database Management System (DBMS).pptxGevitaChinnaiah
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptDrRShaliniVISTAS
 
Database Project Airport management System
Database Project Airport management SystemDatabase Project Airport management System
Database Project Airport management SystemFahad Chishti
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxEliasPetros
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxhjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxEliasPetros
 
Introducing ms sql_server_updated
Introducing ms sql_server_updatedIntroducing ms sql_server_updated
Introducing ms sql_server_updatedleetinhf
 
Sql database development part 1
Sql database development part 1Sql database development part 1
Sql database development part 1Sqlperfomance
 
Database management system by Neeraj Bhandari ( Surkhet.Nepal )
Database management system by Neeraj Bhandari ( Surkhet.Nepal )Database management system by Neeraj Bhandari ( Surkhet.Nepal )
Database management system by Neeraj Bhandari ( Surkhet.Nepal )Neeraj Bhandari
 
Lecture on DBMS & MySQL.pdf v. C. .
Lecture on DBMS & MySQL.pdf v.  C.     .Lecture on DBMS & MySQL.pdf v.  C.     .
Lecture on DBMS & MySQL.pdf v. C. .MayankSinghRawat6
 
Bank mangement system
Bank mangement systemBank mangement system
Bank mangement systemFaisalGhffar
 
Chapter 2: Ms SQL Server
Chapter 2: Ms SQL ServerChapter 2: Ms SQL Server
Chapter 2: Ms SQL ServerNgeam Soly
 
BASIC OF DATABASE PPT new.pptx
BASIC OF DATABASE PPT  new.pptxBASIC OF DATABASE PPT  new.pptx
BASIC OF DATABASE PPT new.pptxNiyatiMandaliya
 
6_SQL.pdf
6_SQL.pdf6_SQL.pdf
6_SQL.pdfLPhct2
 
data manipulation language
data manipulation languagedata manipulation language
data manipulation languageJananiSelvaraj10
 

Similar to SQLSlide (20)

Database Management System (DBMS).pptx
Database Management System (DBMS).pptxDatabase Management System (DBMS).pptx
Database Management System (DBMS).pptx
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.ppt
 
Database Project Airport management System
Database Project Airport management SystemDatabase Project Airport management System
Database Project Airport management System
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
 
Lab
LabLab
Lab
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxhjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
 
Oracle 11g SQL Overview
Oracle 11g SQL OverviewOracle 11g SQL Overview
Oracle 11g SQL Overview
 
Dbms sql-final
Dbms  sql-finalDbms  sql-final
Dbms sql-final
 
lovely
lovelylovely
lovely
 
Introducing ms sql_server_updated
Introducing ms sql_server_updatedIntroducing ms sql_server_updated
Introducing ms sql_server_updated
 
Sql database development part 1
Sql database development part 1Sql database development part 1
Sql database development part 1
 
Database management system by Neeraj Bhandari ( Surkhet.Nepal )
Database management system by Neeraj Bhandari ( Surkhet.Nepal )Database management system by Neeraj Bhandari ( Surkhet.Nepal )
Database management system by Neeraj Bhandari ( Surkhet.Nepal )
 
SQL2.pptx
SQL2.pptxSQL2.pptx
SQL2.pptx
 
Lecture on DBMS & MySQL.pdf v. C. .
Lecture on DBMS & MySQL.pdf v.  C.     .Lecture on DBMS & MySQL.pdf v.  C.     .
Lecture on DBMS & MySQL.pdf v. C. .
 
[PHPUGPH] PHP Roadshow - MySQL
[PHPUGPH] PHP Roadshow - MySQL[PHPUGPH] PHP Roadshow - MySQL
[PHPUGPH] PHP Roadshow - MySQL
 
Bank mangement system
Bank mangement systemBank mangement system
Bank mangement system
 
Chapter 2: Ms SQL Server
Chapter 2: Ms SQL ServerChapter 2: Ms SQL Server
Chapter 2: Ms SQL Server
 
BASIC OF DATABASE PPT new.pptx
BASIC OF DATABASE PPT  new.pptxBASIC OF DATABASE PPT  new.pptx
BASIC OF DATABASE PPT new.pptx
 
6_SQL.pdf
6_SQL.pdf6_SQL.pdf
6_SQL.pdf
 
data manipulation language
data manipulation languagedata manipulation language
data manipulation language
 

Recently uploaded

ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxleah joy valeriano
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 

Recently uploaded (20)

ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 

SQLSlide

  • 1.  Collection of interrelated data  Set of programs to access the data  DBMS contains information about a particular enterprise  DBMS provides an environment that is both convenient and efficient to use.  Database Applications:  Banking: all transactions  Airlines: reservations, schedules  Universities: registration, grades  Sales: customers, products, purchases  Manufacturing: production, inventory, orders, supply chain  Human resources: employee records, salaries, tax deductions  Databases touch all aspects of our lives
  • 2. What is SQL? – When a user wants to get some information from a database file, he can issue a query. 1 – A query is a user–request to retrieve data or information with a certain condition. – SQL is a query language that allows user to specify the conditions. (instead of algorithms)
  • 3. Concept of SQL – The user specifies a certain condition. 1 – The result of the query will then be stored in form of a table. – Statistical information of the data. – The program will go through all the records in the database file and select those records that satisfy the condition.(searching).
  • 4. Both an ANSI and ISO standard Types of commands: 1. Data Definition Language (DDL) : Create, Alter, Drop, Rename, Truncate 2. Data Manipulation Language (DML): Insert, Delete, Update 1. Data Retrieval: Select 2. Transaction Control: Commit, Rollback, Savepoint 3. Data Control Language (DCL): Grant, Revoke
  • 5. 5 A simplified schematic of a typical SQL environment, as described by the SQL-2003 standard
  • 6. 6  Catalog  A set of schemas that constitute the description of a database  Schema (or Database)  The structure that contains descriptions of objects created by a user (base tables, views, constraints)  Data Definition Language (DDL)  Commands that define a database, including creating, altering, and dropping tables and establishing constraints  Data Manipulation Language (DML)  Commands that maintain and query a database  Data Control Language (DCL)  Commands that control a database, including administering privileges and committing data
  • 7. CREATE TABLE {table} ( {column datatype [DEFAULT expr] [column_constraint] ... | table_constraint} [, { column datatype [DEFAULT expr] [column_constraint] ... ) ALTER TABLE {table} [ADD|MODIFY {column datatype [DEFAULT expr] [column_constraint]} [DROP drop_clause] DROP TABLE {table} [cascade constraints] DESC {table}
  • 8. INSERT INTO {table | view} [ (column [, column] ...) ] VALUES (expr,expr ...) UPDATE {table | view } SET { (column [, column] = { expr | } [WHERE condition] DELETE [FROM] {table | view} [WHERE condition]
  • 9. Data Retrieval: SELECT [DISTINCT | ALL] {table|view} FROM {table | view} [WHERE condition ] [GROUP BY expr [, expr]] [ORDER BY {expr} [ASC | DESC]] select * from dept; select deptname from dept where deptid='10'; select lname,fname from emp order by lname desc; select max(salary) from emp group by positionid; select deptname from dept,emp where dept.deptid=emp.deptid and emp.empid='111';
  • 10. Transaction Control: COMMIT ROLLBACK [ to {savepoint}] SAVEPOINT {name} commit; savepoint point1; rollback to point1;
  • 11. Data Control Language: GRANT [privileges] ON object TO user|public [WITH GRANT OPTION] REVOKE [privileges] ON object TO user|public [CASCADE CONSTRAINTS] grant select,update on emp to XYZ ; revoke update on emp to XYZ;
  • 12.
  • 13. SelectionProjection Table 1 Table 2 Table 1Table 1 Join
  • 14.  SELECT identifies the columns to be displayed.  FROM identifies the table containing those columns. SELECT *|{[DISTINCT] column|expression [alias],...} FROM table;
  • 17.  SQL statements are not case-sensitive.  SQL statements can be entered 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.  In SQL Developer, SQL statements can optionally be terminated by a semicolon (;). Semicolons are required when you execute multiple SQL statements.  In SQL*Plus, you are required to end each SQL statement with a semicolon (;).