SlideShare a Scribd company logo
2
Most read
3
Most read
7
Most read
SQL - Structured query language introduction
INTRODUCTION
 SQL (Structured Query Language) is a computer
language aimed to store, manipulate, and retrieve data
stored in relational databases.
 IBM implemented the language, originally called
Sequel, as part of the System R project in the early
1970s..
 The first commercial relational database was released
by Relational Software later becoming oracle.
INTRODUCTION
The SQL language has several parts:
 Data-definition language (DDL). provides
commands for defining relation schemas, deleting
relations, and modifying relation schemas.
 Interactive data-manipulation language (DML). It
includes also commands to insert tuples into, delete
tuples from, and modify tuples in the database.
 View definition. includes commands for defining
views.
 Transaction control. includes commands for
specifying the beginning and ending of transactions.
INTRODUCTION
 Embedded SQL and dynamic SQL. define how SQL
statements can be embedded within general-purpose
programming languages, such as C, C++, Java, PL/I,
Cobol, Pascal, and Fortran.
 Integrity. The SQL DDL includes commands for
specifying integrity constraints that the data stored in
the database must satisfy. Updates that violate integrity
constraints are disallowed.
 Authorization (DCL). The SQL DDL includes
commands for specifying access rights to relations and
views.
SQL - Structured query language introduction
DDL DDL - Data Definition Language:
 Statements used to define the database structure or
schema. Some examples:
 CREATE - to create objects in the database
 ALTER - alters the structure of the database
 DROP - delete objects from the database
 RENAME - rename an object
Schema Definition in SQL
 Create table : Example :
create table branch (branch-name char(15), branch-city
char(30),assets integer,
primary key (branch-name),
check (assets >= 0))
 Delete :
Delete table : drop table r
Delete tuples : Delete from r
 Alter table :
Add Attribute : alter table r add AD
Drop attribute : alter table r drop A
SQL - Structured query language introduction
Data Manipulation Language
DML- Data Manipulation Language:
Statements used for managing data within
schema objects.
 SELECT - retrieve data from the a database
 INSERT - insert data into a table
 UPDATE - updates existing data within a table
 DELETE - deletes all records from a table, the
space for the records remain
 CALL - call a PL/SQL or Java subprogram
Example Setting Schema &
Attributes
 Branch-schema = (branch-name, branch-city,
assets)
 Customer-schema = (customer-name, customer-
street, customer-city)
 Loan-schema = (loan-number, branch-name,
amount)
 Borrower-schema = (customer-name, loan-number)
 Account-schema = (account-number, branch-name,
balance)
 Depositor-schema = (customer-name, account-
number)
Basic SQL Query
 Select Clause :
1. select branch-name from loan Retain Duplicates
2. select distinct branch-name from loan Remove
duplicates
3. select all branch-name from loan Retain Duplicates
 Where Clause :
1. select loan-number from loan where branch-name =
’Perryridge’ and amount > 1200
 From Clause :
select customer-name, borrower.loan-number, amount
from borrower, loan where borrower.loan-number =
loan.loan-number
Basic SQL Query
 Rename Operation :
select customer-name, borrower.loan-number as loan-id,
amount from borrower, loan where borrower.loan-
number = loan.loan-number
 Tuple variables :
select customer-name, T.loan-number, S.amount from
borrower as T, loan as S where T.loan-number = S.loan-
number
Tuple variables are most useful for comparing two tuples
in the same relation.
 String Operations :
select customer-name from customer where customer-
street like ’%Main%’
Basic SQL Query
 Ordering the Display of Tuples :
select distinct customer-name from borrower, loan where
borrower.loan-number = loan.loan-number and branch-
name = ’Perryridge’ order by customer-name
select * from loan order by amount desc, loan-number asc
Set Operations
 Union Operation : find all customers having a loan,
an account, or both
(select customer-name from depositor) union (select
customer-name from borrower) Removes Duplicates
 Intersect Operation : find all customers who have
both a loan and an account
(select distinct customer-name from depositor) intersect
(select distinct customer-name from borrower) Removes
Duplicates
 Except Operation : find all customers who have an
account but no loan
(select distinct customer-name from depositor) except
(select customer-name from borrower)
Aggregate Functions
avg, min, max, sum, count
Example : “Find the average balance for each customer
who lives in Harrison and has at least three accounts.”
select depositor.customer-name, avg (balance)
from depositor, account, customer
where depositor.account-number = account.account-
number and
depositor.customer-name = customer.customer-name and
customer-city = ’Harrison’
group by depositor.customer-name
having count (distinct depositor.account-number) >= 3
Nested Subqueries
 Set Membership : Example : find those customers
who are borrowers from the bank and who appear in
the list of account holders
select distinct customer-name from borrower where
customer-name in (select customer-name from
depositor)
 Set Comparison : Example : Find the names of all
branches that have assets greater than those of at least
one branch located in Brooklyn.
select branch-name from branch where assets > some
(select assets from branch where branch-city =
’Brooklyn’)
>some : greater than at least one member
Views
 Find for each branch the sum of the amounts of all the
loans at the branch.
create view branch-total-loan(branch-name, total-loan) as
select branch-name, sum(amount) from loan groupby
branch-name
Complex Queries
 Derived Relations : Example : “find the maximum
across all branches of the total balance at each branch.”
select max(tot-balance)
from (select branch-name, sum(balance) from account
group by branch-name)
as branch-total (branch-name, tot-balance)
 with Clause : Example : find accounts with the
maximum balance; if there are many accounts with the
same maximum balance, all of them are selected.
with max-balance (value) as
select max(balance) from account
select account-number from account, max-balance
where account.balance = max-balance.value
Modification of the Database
 Deletion :
delete from account where branch-name = ’Perryridge’
 Insertion :
insert into account (account-number, branch-name,
balance) values (’A-9732’, ’Perryridge’, 1200)
 Updates : Example : “Pay 5 percent interest on
accounts whose balance is greater than average”
update account set balance = balance * 1.05
where balance > select avg (balance) from account
Joined Relations
Joined Relations
Joined Relations
Joined Relations
SQL - Structured query language introduction

More Related Content

PPTX
Introduction to SQL
Ehsan Hamzei
 
PPT
Sql ppt
Anuja Lad
 
PPTX
SQL Basics
Hammad Rasheed
 
PPTX
SQL - DML and DDL Commands
Shrija Madhu
 
PDF
SQL Overview
Stewart Rogers
 
PPTX
SQL commands
GirdharRatne
 
PPTX
SQL Commands
Sachidananda M H
 
PPTX
introdution to SQL and SQL functions
farwa waqar
 
Introduction to SQL
Ehsan Hamzei
 
Sql ppt
Anuja Lad
 
SQL Basics
Hammad Rasheed
 
SQL - DML and DDL Commands
Shrija Madhu
 
SQL Overview
Stewart Rogers
 
SQL commands
GirdharRatne
 
SQL Commands
Sachidananda M H
 
introdution to SQL and SQL functions
farwa waqar
 

What's hot (20)

PPTX
database language ppt.pptx
Anusha sivakumar
 
PPTX
SQL(DDL & DML)
Sharad Dubey
 
PPTX
Sql queries presentation
NITISH KUMAR
 
PPTX
SQL Queries Information
Nishant Munjal
 
PPTX
Cursors
Priyanka Yadav
 
PPTX
Types Of Keys in DBMS
PadamNepal1
 
PDF
PL/SQL TRIGGERS
Lakshman Basnet
 
PPTX
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
PPTX
Structured Query Language (SQL)
Syed Hassan Ali
 
PPTX
Dbms architecture
Shubham Dwivedi
 
PPTX
SQL for interview
Aditya Kumar Tripathy
 
ODP
Ms sql-server
Md.Mojibul Hoque
 
PPT
Constraints In Sql
Anurag
 
PPT
Sql dml & tcl 2
Dr. C.V. Suresh Babu
 
PPT
SQL Tutorial - Basic Commands
1keydata
 
PPT
MySQL and its basic commands
Bwsrang Basumatary
 
PDF
Data Models
RituBhargava7
 
PPTX
Presentation on array
topu93
 
PPTX
Group By, Having Clause and Order By clause
Deepam Aggarwal
 
database language ppt.pptx
Anusha sivakumar
 
SQL(DDL & DML)
Sharad Dubey
 
Sql queries presentation
NITISH KUMAR
 
SQL Queries Information
Nishant Munjal
 
Types Of Keys in DBMS
PadamNepal1
 
PL/SQL TRIGGERS
Lakshman Basnet
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Structured Query Language (SQL)
Syed Hassan Ali
 
Dbms architecture
Shubham Dwivedi
 
SQL for interview
Aditya Kumar Tripathy
 
Ms sql-server
Md.Mojibul Hoque
 
Constraints In Sql
Anurag
 
Sql dml & tcl 2
Dr. C.V. Suresh Babu
 
SQL Tutorial - Basic Commands
1keydata
 
MySQL and its basic commands
Bwsrang Basumatary
 
Data Models
RituBhargava7
 
Presentation on array
topu93
 
Group By, Having Clause and Order By clause
Deepam Aggarwal
 
Ad

Viewers also liked (20)

PDF
Introduction to SQL
Ram Kedem
 
PDF
Introduction to Databases
Ram Kedem
 
PPT
SQL : introduction
Shakila Mahjabin
 
PPT
Data manipulation language
Universitas Bina Darma Palembang
 
PDF
Part 7 ddl dan dml lant..retriving data up
Denny Yahya
 
PPT
Podcasting in Libraries
Mark O'English
 
PDF
Using Wordpress To Create Your Website
Nicole C. Engard
 
PPTX
Digital Disruption: A Librarian's perspective
Jane Cowell
 
PPT
Programming for Babies at your Library
Indiana State Library
 
PPTX
Fundamentals of database system - Database System Concepts and Architecture
Mustafa Kamel Mohammadi
 
PPT
DDL DML sysytems
bhujendhar05
 
PDF
Coding as a Practical Library Program
Jennifer Koerber
 
DOCX
retrieving data using SQL statements
Arun Nair
 
PPT
Podcasting for Library Instruction
Debbie Herman
 
PPTX
12 Things You Should Know About Library Guides
this_shanti
 
PPTX
Successfully Using QR Codes in Libraries
Cheryl Burnette
 
PPTX
Sql server ___________session_19(triggers)
Ehtisham Ali
 
PPT
Relational Model in dbms & sql database
gourav kottawar
 
PPTX
Content Strategy for Library Websites
Rebecca Blakiston
 
Introduction to SQL
Ram Kedem
 
Introduction to Databases
Ram Kedem
 
SQL : introduction
Shakila Mahjabin
 
Data manipulation language
Universitas Bina Darma Palembang
 
Part 7 ddl dan dml lant..retriving data up
Denny Yahya
 
Podcasting in Libraries
Mark O'English
 
Using Wordpress To Create Your Website
Nicole C. Engard
 
Digital Disruption: A Librarian's perspective
Jane Cowell
 
Programming for Babies at your Library
Indiana State Library
 
Fundamentals of database system - Database System Concepts and Architecture
Mustafa Kamel Mohammadi
 
DDL DML sysytems
bhujendhar05
 
Coding as a Practical Library Program
Jennifer Koerber
 
retrieving data using SQL statements
Arun Nair
 
Podcasting for Library Instruction
Debbie Herman
 
12 Things You Should Know About Library Guides
this_shanti
 
Successfully Using QR Codes in Libraries
Cheryl Burnette
 
Sql server ___________session_19(triggers)
Ehtisham Ali
 
Relational Model in dbms & sql database
gourav kottawar
 
Content Strategy for Library Websites
Rebecca Blakiston
 
Ad

Similar to SQL - Structured query language introduction (20)

PPT
Unit04 dbms
arnold 7490
 
PPT
ch3[1].ppt
IndraThanaya1
 
PPT
Ch3
Deny Fauzy
 
DOCX
dbms first unit
Raghu Bright
 
PPT
Unit 04 dbms
anuragmbst
 
PPT
sql- introduction-notmine- uploading share
MariaLuisaCarlos
 
PPT
Mysql classes in navi-mumbai,mysql course-provider-in-navi-mumbai
anshkhurana01
 
PPT
mysql_tutorial dan penjelasan rinci .ppt
icomcomputer19
 
PPT
Sql server select queries ppt 18
Vibrant Technologies & Computers
 
PDF
MySQL 指南
YUCHENG HU
 
PPT
Tutorial on MySQl and its basic concepts
anishacotta2
 
PPT
mysql.ppt
nawaz65
 
PPTX
RDBMS
NilaNila16
 
PPT
My sql advacnce topics
Prabhat gangwar
 
PPT
chapter4 contains details about sql queries.ppt
juhishrivastava25
 
PPTX
Quick Revision on DATA BASE MANAGEMENT SYSTEMS concepts.pptx
fouziasulthanak
 
PPT
dbs class 7.ppt
MARasheed3
 
PDF
CS121Lec04.pdf
georgejustymirobi1
 
PPT
SQL PPT.ppt
hemamalinikrishnan2
 
Unit04 dbms
arnold 7490
 
ch3[1].ppt
IndraThanaya1
 
dbms first unit
Raghu Bright
 
Unit 04 dbms
anuragmbst
 
sql- introduction-notmine- uploading share
MariaLuisaCarlos
 
Mysql classes in navi-mumbai,mysql course-provider-in-navi-mumbai
anshkhurana01
 
mysql_tutorial dan penjelasan rinci .ppt
icomcomputer19
 
Sql server select queries ppt 18
Vibrant Technologies & Computers
 
MySQL 指南
YUCHENG HU
 
Tutorial on MySQl and its basic concepts
anishacotta2
 
mysql.ppt
nawaz65
 
RDBMS
NilaNila16
 
My sql advacnce topics
Prabhat gangwar
 
chapter4 contains details about sql queries.ppt
juhishrivastava25
 
Quick Revision on DATA BASE MANAGEMENT SYSTEMS concepts.pptx
fouziasulthanak
 
dbs class 7.ppt
MARasheed3
 
CS121Lec04.pdf
georgejustymirobi1
 
SQL PPT.ppt
hemamalinikrishnan2
 

Recently uploaded (20)

PPTX
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
PPTX
Information Retrieval and Extraction - Module 7
premSankar19
 
PPT
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
PDF
top-5-use-cases-for-splunk-security-analytics.pdf
yaghutialireza
 
PDF
Zero Carbon Building Performance standard
BassemOsman1
 
PDF
flutter Launcher Icons, Splash Screens & Fonts
Ahmed Mohamed
 
PPTX
Color Model in Textile ( RGB, CMYK).pptx
auladhossain191
 
PDF
Software Testing Tools - names and explanation
shruti533256
 
DOCX
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
PDF
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
PDF
July 2025: Top 10 Read Articles Advanced Information Technology
ijait
 
PDF
Introduction to Data Science: data science process
ShivarkarSandip
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PPTX
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
PPTX
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
PPTX
easa module 3 funtamental electronics.pptx
tryanothert7
 
PDF
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
PDF
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
PDF
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
PPTX
Introduction of deep learning in cse.pptx
fizarcse
 
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
Information Retrieval and Extraction - Module 7
premSankar19
 
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
top-5-use-cases-for-splunk-security-analytics.pdf
yaghutialireza
 
Zero Carbon Building Performance standard
BassemOsman1
 
flutter Launcher Icons, Splash Screens & Fonts
Ahmed Mohamed
 
Color Model in Textile ( RGB, CMYK).pptx
auladhossain191
 
Software Testing Tools - names and explanation
shruti533256
 
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
July 2025: Top 10 Read Articles Advanced Information Technology
ijait
 
Introduction to Data Science: data science process
ShivarkarSandip
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
easa module 3 funtamental electronics.pptx
tryanothert7
 
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
Introduction of deep learning in cse.pptx
fizarcse
 

SQL - Structured query language introduction

  • 2. INTRODUCTION  SQL (Structured Query Language) is a computer language aimed to store, manipulate, and retrieve data stored in relational databases.  IBM implemented the language, originally called Sequel, as part of the System R project in the early 1970s..  The first commercial relational database was released by Relational Software later becoming oracle.
  • 3. INTRODUCTION The SQL language has several parts:  Data-definition language (DDL). provides commands for defining relation schemas, deleting relations, and modifying relation schemas.  Interactive data-manipulation language (DML). It includes also commands to insert tuples into, delete tuples from, and modify tuples in the database.  View definition. includes commands for defining views.  Transaction control. includes commands for specifying the beginning and ending of transactions.
  • 4. INTRODUCTION  Embedded SQL and dynamic SQL. define how SQL statements can be embedded within general-purpose programming languages, such as C, C++, Java, PL/I, Cobol, Pascal, and Fortran.  Integrity. The SQL DDL includes commands for specifying integrity constraints that the data stored in the database must satisfy. Updates that violate integrity constraints are disallowed.  Authorization (DCL). The SQL DDL includes commands for specifying access rights to relations and views.
  • 6. DDL DDL - Data Definition Language:  Statements used to define the database structure or schema. Some examples:  CREATE - to create objects in the database  ALTER - alters the structure of the database  DROP - delete objects from the database  RENAME - rename an object
  • 7. Schema Definition in SQL  Create table : Example : create table branch (branch-name char(15), branch-city char(30),assets integer, primary key (branch-name), check (assets >= 0))  Delete : Delete table : drop table r Delete tuples : Delete from r  Alter table : Add Attribute : alter table r add AD Drop attribute : alter table r drop A
  • 9. Data Manipulation Language DML- Data Manipulation Language: Statements used for managing data within schema objects.  SELECT - retrieve data from the a database  INSERT - insert data into a table  UPDATE - updates existing data within a table  DELETE - deletes all records from a table, the space for the records remain  CALL - call a PL/SQL or Java subprogram
  • 10. Example Setting Schema & Attributes  Branch-schema = (branch-name, branch-city, assets)  Customer-schema = (customer-name, customer- street, customer-city)  Loan-schema = (loan-number, branch-name, amount)  Borrower-schema = (customer-name, loan-number)  Account-schema = (account-number, branch-name, balance)  Depositor-schema = (customer-name, account- number)
  • 11. Basic SQL Query  Select Clause : 1. select branch-name from loan Retain Duplicates 2. select distinct branch-name from loan Remove duplicates 3. select all branch-name from loan Retain Duplicates  Where Clause : 1. select loan-number from loan where branch-name = ’Perryridge’ and amount > 1200  From Clause : select customer-name, borrower.loan-number, amount from borrower, loan where borrower.loan-number = loan.loan-number
  • 12. Basic SQL Query  Rename Operation : select customer-name, borrower.loan-number as loan-id, amount from borrower, loan where borrower.loan- number = loan.loan-number  Tuple variables : select customer-name, T.loan-number, S.amount from borrower as T, loan as S where T.loan-number = S.loan- number Tuple variables are most useful for comparing two tuples in the same relation.  String Operations : select customer-name from customer where customer- street like ’%Main%’
  • 13. Basic SQL Query  Ordering the Display of Tuples : select distinct customer-name from borrower, loan where borrower.loan-number = loan.loan-number and branch- name = ’Perryridge’ order by customer-name select * from loan order by amount desc, loan-number asc
  • 14. Set Operations  Union Operation : find all customers having a loan, an account, or both (select customer-name from depositor) union (select customer-name from borrower) Removes Duplicates  Intersect Operation : find all customers who have both a loan and an account (select distinct customer-name from depositor) intersect (select distinct customer-name from borrower) Removes Duplicates  Except Operation : find all customers who have an account but no loan (select distinct customer-name from depositor) except (select customer-name from borrower)
  • 15. Aggregate Functions avg, min, max, sum, count Example : “Find the average balance for each customer who lives in Harrison and has at least three accounts.” select depositor.customer-name, avg (balance) from depositor, account, customer where depositor.account-number = account.account- number and depositor.customer-name = customer.customer-name and customer-city = ’Harrison’ group by depositor.customer-name having count (distinct depositor.account-number) >= 3
  • 16. Nested Subqueries  Set Membership : Example : find those customers who are borrowers from the bank and who appear in the list of account holders select distinct customer-name from borrower where customer-name in (select customer-name from depositor)  Set Comparison : Example : Find the names of all branches that have assets greater than those of at least one branch located in Brooklyn. select branch-name from branch where assets > some (select assets from branch where branch-city = ’Brooklyn’) >some : greater than at least one member
  • 17. Views  Find for each branch the sum of the amounts of all the loans at the branch. create view branch-total-loan(branch-name, total-loan) as select branch-name, sum(amount) from loan groupby branch-name
  • 18. Complex Queries  Derived Relations : Example : “find the maximum across all branches of the total balance at each branch.” select max(tot-balance) from (select branch-name, sum(balance) from account group by branch-name) as branch-total (branch-name, tot-balance)  with Clause : Example : find accounts with the maximum balance; if there are many accounts with the same maximum balance, all of them are selected. with max-balance (value) as select max(balance) from account select account-number from account, max-balance where account.balance = max-balance.value
  • 19. Modification of the Database  Deletion : delete from account where branch-name = ’Perryridge’  Insertion : insert into account (account-number, branch-name, balance) values (’A-9732’, ’Perryridge’, 1200)  Updates : Example : “Pay 5 percent interest on accounts whose balance is greater than average” update account set balance = balance * 1.05 where balance > select avg (balance) from account

Editor's Notes

  • #3: IBM developed the original version of SQL at its San Jose Research Laboratory (now the Almaden Research Center).The Sequel language has evolved since then, and its name has changed to SQL (Structured Query Language).
  • #4: The SQL DML includes a query language based on both the relational algebra and the tuple relational calculus.
  • #8: where r is the name of an existing relation, A is the name of the attribute to be added, and D is the domain of the added attribute.
  • #12: Similarly, we can use the not between comparison operator. SQL uses the logical connectives and, or, and not—rather than the mathematical symbols ∧, ∨, and ¬ —in the where clause. The from clause by itself defines a Cartesian product of the relations in the clause. Notice that SQL uses the notation relation-name.attribute-name, as does the relational algebra, to avoid ambiguity in cases where an attribute appears in the schema of more than one relation. We could have written borrower.customer-name instead of customername in the select clause. However, since the attribute customer-name appears in only one of the relations named in the from clause, there is no ambiguity when we write customer-name.
  • #13: SQL provides a mechanism for renaming both relations and attributes. Ex. Find the names of all branches that have assets greater than those of at least one branch located in Brooklyn. select distinct T.branch-name from branch as T, branch as S where T.assets > S.assets and S.branch-city = ’Brooklyn’ Percent (%): The % character matches any substring. Underscore ( _): The _ character matches any character.
  • #14: By default, the order by clause lists items in ascending order.
  • #15: If we want to retain all duplicates, we must write union all in place of union Opposites Union : union all Intersect : intersect all Except : except all
  • #16: Group by clause: Tuples with the same value on all attributes in the group by clause are placed in one group. Having clause : state a condition that applies to groups rather than to tuples. Count clause : to count the number of tuples in a relation. priority Where clause>having clause
  • #17: Opposites : in : not in Alternate way to write second query : select distinct T.branch-name from branch as T, branch as S where T.assets > S.assets and S.branch-city = ’Brooklyn’ SQL also allows < some, <= some, >= some, = some, and<> some comparisons. As an exercise, verify that = some is identical to in, whereas <> some is not the same as not in.