SlideShare a Scribd company logo
Database System Sunita M. Dol
Page 1
HANDOUT#04
Aim:
Basic SQL: Write simple queries in SQL on the schema created for a specific application.
Theory:
SQL is based on set and relational operations with certain modifications and enhancements. A
typical SQL query has the form:
select A1, A2, ..., An
from r1, r2, ..., rm
where P
– Ai represents an attribute,
– Ri represents a relation and
– P is a predicate.
The SELECT Clause
The select clause list the attributes desired in the result of a query. SQL allows duplicates in
relations as well as in query results. To force the elimination of duplicates, insert the keyword
distinct after select. The keyword all specifies that duplicates not be removed. An asterisk in the
select clause denotes “all attributes”. The select clause can contain arithmetic expressions
involving the operation, +, –, *, and /, and operating on constants or attributes of tuples.
The WHERE Clause
The where clause specifies conditions that the result must satisfy. Comparison results can be
combined using the logical connectives and, or, and not. Comparisons can be applied to results
of arithmetic expressions. SQL includes a between comparison operator.
The FROM Clause
The from clause lists the relations involved in the query.
The RENAME Operation
The SQL allows renaming relations and attributes using the as clause:
old-name as new-name
Tuple Variables
Tuple variables are defined in the from clause via the use of the as clause. Keyword as is
optional and may be omitted
borrower as T ≡ borrower T
Database System Sunita M. Dol
Page 2
String Operations
SQL includes a string-matching operator for comparisons on character strings. The operator
“like” uses patterns that are described using two special characters:
• percent (%). The % character matches any substring.
• underscore (_). The _ character matches any character.
SQL supports a variety of string operations such as
• concatenation (using “||”)
• converting from upper to lower case (and vice versa)
• Finding string length, extracting substrings, etc.
Ordering the display of tuples
SQL offers the user some control over the order in which tuples in a relation are displayed. The
order by clause causes the tuples in the result of a query to appear in sorted order. We may
specify desc for descending order or asc for ascending order, for each attribute; ascending order
is the default.
Set Operations:
The SQL operations union, intersect, and except operate on relations and correspond to the
relational-algebra operations ∪, ∩, and −. Like union, intersection, and set difference in
relational algebra, the relations participating in the operations must be compatible; that is, they
must have the same set of attributes.
• In union operation, the number of duplicate tuples in the result is equal to the total
number of duplicates that appear in both d and b. Thus, if Jones has three accounts and
two loans at the bank, then there will be five tuples with the name Jones in the result.
• In intersection operation, the number of duplicate tuples that appear in the result is equal
to the minimum number of duplicates in both d and b. Thus, if Jones has three accounts
and two loans at the bank, then there will be two tuples with the name Jones in the result.
In except operation, the number of duplicate copies of a tuple in the result is equal to the number
of duplicate copies of the tuple in d minus the number of duplicate copies of the tuple in b,
provided that the difference is positive. Thus, if Jones has three accounts and one loan at the
bank, then there will be two tuples with the name Jones in the result. If, instead, this customer
has two accounts and three loans at the bank, there will be no tuple with the name Jones in the
result.
Queries and Output:
Select-From-Where Clause
Find the names of all branches in the loan relation
SQL> select branch_name from loan;
Database System Sunita M. Dol
Page 3
BRANCH_NAME
---------------
Round Hill
Downtown
Perryridge
Perryridge
Downtown
Redwood
Mianus
7 rows selected.
List the tuples of loan relation with amount multiplied by 100.
SQL> select * from loan;
LOAN_NUMBE BRANCH_NAME AMOUNT
---------- --------------- ----------
L-11 Round Hill 900
L-14 Downtown 1500
L-15 Perryridge 1500
L-16 Perryridge 1300
L-17 Downtown 1000
L-23 Redwood 2000
L-93 Mianus 500
7 rows selected.
SQL> select loan_number,branch_name,amount*100 from loan;
LOAN_NUMBE BRANCH_NAME AMOUNT*100
---------- --------------- ----------
L-11 Round Hill 90000
L-14 Downtown 150000
L-15 Perryridge 150000
L-16 Perryridge 130000
L-17 Downtown 100000
L-23 Redwood 200000
L-93 Mianus 50000
7 rows selected.
Database System Sunita M. Dol
Page 4
Find all loan numbers for the loans made at Perryridge branch with amount greater than
$1200.
SQL> select * from loan;
LOAN_NUMBE BRANCH_NAME AMOUNT
---------- --------------- ----------
L-11 Round Hill 900
L-14 Downtown 1500
L-15 Perryridge 1500
L-16 Perryridge 1300
L-17 Downtown 1000
L-23 Redwood 2000
L-93 Mianus 500
7 rows selected.
SQL> select loan_number from loan where branch_name='Perryridge' and amount>1200;
LOAN_NUMBE
----------
L-15
L-16
Rename Operation
SQL> select * from loan;
LOAN_NUMBE BRANCH_NAME AMOUNT
---------- --------------- ----------
L-11 Round Hill 900
L-14 Downtown 1500
L-15 Perryridge 1500
L-16 Perryridge 1300
L-17 Downtown 1000
L-23 Redwood 2000
L-93 Mianus 500
7 rows selected.
SQL> select customer_name,borrower.loan_number as loan_id,amount
2 from borrower,loan
Database System Sunita M. Dol
Page 5
3 where borrower.loan_number=loan.loan_number;
CUSTOMER_NAME LOAN_ID AMOUNT
-------------------- ---------- ----------
Smith L-11 900
Hayes L-15 1500
Adams L-16 1300
Williams L-17 1000
Jones L-17 1000
Smith L-23 2000
Curry L-93 500
7 rows selected.
Tuple Variables
Find the names of all branches that have assets greater than at least one branch located in
Brooklyn.
SQL> select * from branch;
BRANCH_NAME BRANCH_CITY ASSETS
--------------- --------------- ----------
Brighton Brooklyn 7100000
Downtown Brooklyn 9000000
Mianus Horseneck 400000
North Town Rye 3700000
Perryridge Horseneck 1700000
Pownal Bennington 300000
Redwood Palo Alto 2100000
Round Hill Horseneck 8000000
8 rows selected.
SQL> select distinct T.branch_name
2 from branch T,branch S
3 where T.assets>S.assets
4 and S.branch_city='Brooklyn';
BRANCH_NAME
---------------
Round Hill
Database System Sunita M. Dol
Page 6
Downtown
String Operations
Find the names of all customers whose street address includes substring 'Main'.
SQL> select * from customer;
CUSTOMER_NAME CUSTOMER_STREET
-------------------- ------------------------------
CUSTOMER_CITY
------------------------------
Adams Spring
Pittsfield
Brooks Senator
Brooklyn
Curry North
Rye
CUSTOMER_NAME CUSTOMER_STREET
-------------------- ------------------------------
CUSTOMER_CITY
------------------------------
Glenn Sand Hill
Woodside
Green Walnut
Stamford
Hayes Main
Harrison
CUSTOMER_NAME CUSTOMER_STREET
-------------------- ------------------------------
CUSTOMER_CITY
------------------------------
Johnson Alma
Palo Alto
Database System Sunita M. Dol
Page 7
Jones Main
Harrison
Lindsay Park
Pittsfield
CUSTOMER_NAME CUSTOMER_STREET
-------------------- ------------------------------
CUSTOMER_CITY
------------------------------
Smith North
Rye
Turner Putnam
Stamford
Williams Nassau
Princeton
12 rows selected.
SQL> select customer_name from customer where customer_street like '%Main%';
CUSTOMER_NAME
--------------------
Hayes
Jones
Ordering the display of tuples
List the entire loan relation in descending order of amount.If several loans have the same
amount then order them in ascending order by loan number.
SQL> select * from loan;
LOAN_NUMBE BRANCH_NAME AMOUNT
---------- --------------- ----------
L-11 Round Hill 900
Database System Sunita M. Dol
Page 8
L-14 Downtown 1500
L-15 Perryridge 1500
L-16 Perryridge 1300
L-17 Downtown 1000
L-23 Redwood 2000
L-93 Mianus 500
7 rows selected.
SQL> select * from loan
2 order by amount desc,loan_number asc;
LOAN_NUMBE BRANCH_NAME AMOUNT
---------- --------------- ----------
L-23 Redwood 2000
L-14 Downtown 1500
L-15 Perryridge 1500
L-16 Perryridge 1300
L-17 Downtown 1000
L-11 Round Hill 900
L-93 Mianus 500
7 rows selected.
Set Operations
The set of all customers who have an account at the bank
SQL> select * from depositor;
CUSTOMER_NAME ACCOUNT_NU
-------------------- ----------
Hayes A-102
Johnson A-101
Johnson A-201
Jones A-217
Lindsay A-222
Smith A-215
Turner A-305
7 rows selected.
Database System Sunita M. Dol
Page 9
SQL> select customer_name from depositor;
CUSTOMER_NAME
--------------------
Hayes
Johnson
Johnson
Jones
Lindsay
Smith
Turner
7 rows selected.
The set of customers who have loan at the bank.
SQL> select * from borrower;
CUSTOMER_NAME LOAN_NUMBE
-------------------- ----------
Adams L-16
Curry L-93
Hayes L-15
Jones L-17
Smith L-11
Smith L-23
Williams L-17
7 rows selected.
SQL> select customer_name from borrower;
CUSTOMER_NAME
--------------------
Adams
Curry
Hayes
Jones
Smith
Smith
Williams
Database System Sunita M. Dol
Page 10
7 rows selected.
Find all the bank customer having loan,an account or both at the bank.
SQL> (select customer_name from depositor)
2 union
3 (select customer_name from borrower);
CUSTOMER_NAME
--------------------
Adams
Curry
Hayes
Johnson
Jones
Lindsay
Smith
Turner
Williams
9 rows selected.
SQL> (select customer_name from depositor)
2 union all
3 (select customer_name from borrower);
CUSTOMER_NAME
--------------------
Hayes
Johnson
Johnson
Jones
Lindsay
Smith
Turner
Adams
Curry
Hayes
Jones
Database System Sunita M. Dol
Page 11
CUSTOMER_NAME
--------------------
Smith
Smith
Williams
14 rows selected.
Find all the bank customer having loan and an account at the bank.
SQL> (select customer_name from depositor)
2 intersect
3 (select customer_name from borrower);
CUSTOMER_NAME
--------------------
Hayes
Jones
Smith
Find all customers who have an account but no loan at the bank.
SQL> (select customer_name from depositor) minus (select customer_name from borrower);
CUSTOMER_NAME
--------------------
Johnson
Lindsay
Turner
Conclusion:
We have written simple queries in SQL using
• Select-from-where
• Rename operation
• Tuple variables
• String Operation
• Ordering the display of tuples
• Set operations
References:
Database System Sunita M. Dol
Page 12
• Database system concepts by Abraham Silberschatz, Henry F. Korth, S. Sudarshan
(McGraw Hill International Edition) sixth edition.
• Database system concepts by Abraham Silberschatz, Henry F. Korth, S. Sudarshan
(McGraw Hill International Edition) fifth edition.
• http://codex.cs.yale.edu/avi/db-book/db4/slide-dir/
• http://codex.cs.yale.edu/avi/db-book/db5/slide-dir/
• http://codex.cs.yale.edu/avi/db-book/db6/slide-dir/

More Related Content

What's hot

STRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIESSTRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIES
VENNILAV6
 
Database queries
Database queriesDatabase queries
Database queries
IIUM
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
farwa waqar
 
SQL commands
SQL commandsSQL commands
SQL commands
GirdharRatne
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
Nishant Munjal
 
Basic sql Commands
Basic sql CommandsBasic sql Commands
Basic sql Commands
MUHAMMED MASHAHIL PUKKUNNUMMAL
 
Sql commands
Sql commandsSql commands
Sql commands
Prof. Dr. K. Adisesha
 
Advanced SQL Webinar
Advanced SQL WebinarAdvanced SQL Webinar
Advanced SQL Webinar
Ram Kedem
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
Hammad Rasheed
 
SQL Queries
SQL QueriesSQL Queries
SQL Queries
Nilt1234
 
DBMS Notes: DDL DML DCL
DBMS Notes: DDL DML DCLDBMS Notes: DDL DML DCL
DBMS Notes: DDL DML DCL
Sreedhar Chowdam
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
Stewart Rogers
 
Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013
Prosanta Ghosh
 
Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2
Eddyzulham Mahluzydde
 
Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013
Prosanta Ghosh
 
ch3
ch3ch3
SQL Commands
SQL Commands SQL Commands
SQL Commands
Sachidananda M H
 
12 SQL
12 SQL12 SQL
Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3
Eddyzulham Mahluzydde
 
Sql.pptx
Sql.pptxSql.pptx
Sql.pptx
TanishaKochak
 

What's hot (20)

STRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIESSTRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIES
 
Database queries
Database queriesDatabase queries
Database queries
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
 
SQL commands
SQL commandsSQL commands
SQL commands
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
 
Basic sql Commands
Basic sql CommandsBasic sql Commands
Basic sql Commands
 
Sql commands
Sql commandsSql commands
Sql commands
 
Advanced SQL Webinar
Advanced SQL WebinarAdvanced SQL Webinar
Advanced SQL Webinar
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
SQL Queries
SQL QueriesSQL Queries
SQL Queries
 
DBMS Notes: DDL DML DCL
DBMS Notes: DDL DML DCLDBMS Notes: DDL DML DCL
DBMS Notes: DDL DML DCL
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
 
Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013Dbms ii mca-ch7-sql-2013
Dbms ii mca-ch7-sql-2013
 
Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2
 
Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013
 
ch3
ch3ch3
ch3
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
12 SQL
12 SQL12 SQL
12 SQL
 
Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3
 
Sql.pptx
Sql.pptxSql.pptx
Sql.pptx
 

Similar to Assignment#04

dbms first unit
dbms first unitdbms first unit
dbms first unit
Raghu Bright
 
Unit04 dbms
Unit04 dbmsUnit04 dbms
Unit04 dbms
arnold 7490
 
SQL PPT.ppt
SQL PPT.pptSQL PPT.ppt
SQL PPT.ppt
hemamalinikrishnan2
 
Unit 04 dbms
Unit 04 dbmsUnit 04 dbms
Unit 04 dbms
anuragmbst
 
4. SQL in DBMS
4. SQL in DBMS4. SQL in DBMS
4. SQL in DBMS
koolkampus
 
Data Warehouse , Data Cube Computation
Data Warehouse   , Data Cube ComputationData Warehouse   , Data Cube Computation
Data Warehouse , Data Cube Computation
sit20ad004
 
Sql server select queries ppt 18
Sql server select queries ppt 18Sql server select queries ppt 18
Sql server select queries ppt 18
Vibrant Technologies & Computers
 
My sql advacnce topics
My sql advacnce topicsMy sql advacnce topics
My sql advacnce topics
Prabhat gangwar
 
Beginers guide for oracle sql
Beginers guide for oracle sqlBeginers guide for oracle sql
Beginers guide for oracle sql
N.Jagadish Kumar
 
Ch4
Ch4Ch4
MySQL 指南
MySQL 指南MySQL 指南
MySQL 指南
YUCHENG HU
 
Ch3
Ch3Ch3
5. Other Relational Languages in DBMS
5. Other Relational Languages in DBMS5. Other Relational Languages in DBMS
5. Other Relational Languages in DBMS
koolkampus
 
Mysql classes in navi-mumbai,mysql course-provider-in-navi-mumbai
Mysql classes in navi-mumbai,mysql course-provider-in-navi-mumbaiMysql classes in navi-mumbai,mysql course-provider-in-navi-mumbai
Mysql classes in navi-mumbai,mysql course-provider-in-navi-mumbai
anshkhurana01
 
Sql
SqlSql
DB_lecturs8 27 11.pptx
DB_lecturs8 27 11.pptxDB_lecturs8 27 11.pptx
DB_lecturs8 27 11.pptx
NermeenKamel7
 
relational algebra and it's implementation
relational algebra and it's implementationrelational algebra and it's implementation
relational algebra and it's implementation
dbmscse61
 
Mysql tutorial
Mysql tutorialMysql tutorial
Mysql tutorial
santosh mishra
 
Mysql tutorial
Mysql tutorialMysql tutorial
Mysql tutorial
santosh mishra
 
Mysql tutorial
Mysql tutorialMysql tutorial
Mysql tutorial
santosh mishra
 

Similar to Assignment#04 (20)

dbms first unit
dbms first unitdbms first unit
dbms first unit
 
Unit04 dbms
Unit04 dbmsUnit04 dbms
Unit04 dbms
 
SQL PPT.ppt
SQL PPT.pptSQL PPT.ppt
SQL PPT.ppt
 
Unit 04 dbms
Unit 04 dbmsUnit 04 dbms
Unit 04 dbms
 
4. SQL in DBMS
4. SQL in DBMS4. SQL in DBMS
4. SQL in DBMS
 
Data Warehouse , Data Cube Computation
Data Warehouse   , Data Cube ComputationData Warehouse   , Data Cube Computation
Data Warehouse , Data Cube Computation
 
Sql server select queries ppt 18
Sql server select queries ppt 18Sql server select queries ppt 18
Sql server select queries ppt 18
 
My sql advacnce topics
My sql advacnce topicsMy sql advacnce topics
My sql advacnce topics
 
Beginers guide for oracle sql
Beginers guide for oracle sqlBeginers guide for oracle sql
Beginers guide for oracle sql
 
Ch4
Ch4Ch4
Ch4
 
MySQL 指南
MySQL 指南MySQL 指南
MySQL 指南
 
Ch3
Ch3Ch3
Ch3
 
5. Other Relational Languages in DBMS
5. Other Relational Languages in DBMS5. Other Relational Languages in DBMS
5. Other Relational Languages in DBMS
 
Mysql classes in navi-mumbai,mysql course-provider-in-navi-mumbai
Mysql classes in navi-mumbai,mysql course-provider-in-navi-mumbaiMysql classes in navi-mumbai,mysql course-provider-in-navi-mumbai
Mysql classes in navi-mumbai,mysql course-provider-in-navi-mumbai
 
Sql
SqlSql
Sql
 
DB_lecturs8 27 11.pptx
DB_lecturs8 27 11.pptxDB_lecturs8 27 11.pptx
DB_lecturs8 27 11.pptx
 
relational algebra and it's implementation
relational algebra and it's implementationrelational algebra and it's implementation
relational algebra and it's implementation
 
Mysql tutorial
Mysql tutorialMysql tutorial
Mysql tutorial
 
Mysql tutorial
Mysql tutorialMysql tutorial
Mysql tutorial
 
Mysql tutorial
Mysql tutorialMysql tutorial
Mysql tutorial
 

More from Sunita Milind Dol

Unit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and PublishingUnit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and Publishing
Sunita Milind Dol
 
Unit Number 4 - Research reports and Thesis writing
Unit Number 4 - Research reports and Thesis writingUnit Number 4 - Research reports and Thesis writing
Unit Number 4 - Research reports and Thesis writing
Sunita Milind Dol
 
Unit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical AnalysisUnit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical Analysis
Sunita Milind Dol
 
Unit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and MethodsUnit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and Methods
Sunita Milind Dol
 
Unit Number 1 - Introduction to Research
Unit Number 1 - Introduction to ResearchUnit Number 1 - Introduction to Research
Unit Number 1 - Introduction to Research
Sunita Milind Dol
 
Unit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and PublishingUnit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and Publishing
Sunita Milind Dol
 
Unit Number 5 - Research reports and Thesis writing
Unit Number 5 - Research reports and Thesis writingUnit Number 5 - Research reports and Thesis writing
Unit Number 5 - Research reports and Thesis writing
Sunita Milind Dol
 
Unit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical AnalysisUnit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical Analysis
Sunita Milind Dol
 
Unit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and MethodsUnit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and Methods
Sunita Milind Dol
 
Unit Number 1 : Introduction to Research
Unit Number 1 : Introduction to ResearchUnit Number 1 : Introduction to Research
Unit Number 1 : Introduction to Research
Sunita Milind Dol
 
9.Joins.pdf
9.Joins.pdf9.Joins.pdf
9.Joins.pdf
Sunita Milind Dol
 
8.Views.pdf
8.Views.pdf8.Views.pdf
8.Views.pdf
Sunita Milind Dol
 
7. Nested Subqueries.pdf
7. Nested Subqueries.pdf7. Nested Subqueries.pdf
7. Nested Subqueries.pdf
Sunita Milind Dol
 
6. Aggregate Functions.pdf
6. Aggregate Functions.pdf6. Aggregate Functions.pdf
6. Aggregate Functions.pdf
Sunita Milind Dol
 
5. Basic Structure of SQL Queries.pdf
5. Basic Structure of SQL Queries.pdf5. Basic Structure of SQL Queries.pdf
5. Basic Structure of SQL Queries.pdf
Sunita Milind Dol
 
4. DML.pdf
4. DML.pdf4. DML.pdf
4. DML.pdf
Sunita Milind Dol
 
3. DDL.pdf
3. DDL.pdf3. DDL.pdf
3. DDL.pdf
Sunita Milind Dol
 
2. SQL Introduction.pdf
2. SQL Introduction.pdf2. SQL Introduction.pdf
2. SQL Introduction.pdf
Sunita Milind Dol
 
1. University Example.pdf
1. University Example.pdf1. University Example.pdf
1. University Example.pdf
Sunita Milind Dol
 
Assignment12
Assignment12Assignment12
Assignment12
Sunita Milind Dol
 

More from Sunita Milind Dol (20)

Unit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and PublishingUnit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and Publishing
 
Unit Number 4 - Research reports and Thesis writing
Unit Number 4 - Research reports and Thesis writingUnit Number 4 - Research reports and Thesis writing
Unit Number 4 - Research reports and Thesis writing
 
Unit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical AnalysisUnit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical Analysis
 
Unit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and MethodsUnit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and Methods
 
Unit Number 1 - Introduction to Research
Unit Number 1 - Introduction to ResearchUnit Number 1 - Introduction to Research
Unit Number 1 - Introduction to Research
 
Unit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and PublishingUnit Number 5 - Research Ethics, IPR and Publishing
Unit Number 5 - Research Ethics, IPR and Publishing
 
Unit Number 5 - Research reports and Thesis writing
Unit Number 5 - Research reports and Thesis writingUnit Number 5 - Research reports and Thesis writing
Unit Number 5 - Research reports and Thesis writing
 
Unit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical AnalysisUnit Number 3 - Data collection and Statistical Analysis
Unit Number 3 - Data collection and Statistical Analysis
 
Unit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and MethodsUnit Number 2 - Research Problem Formulation and Methods
Unit Number 2 - Research Problem Formulation and Methods
 
Unit Number 1 : Introduction to Research
Unit Number 1 : Introduction to ResearchUnit Number 1 : Introduction to Research
Unit Number 1 : Introduction to Research
 
9.Joins.pdf
9.Joins.pdf9.Joins.pdf
9.Joins.pdf
 
8.Views.pdf
8.Views.pdf8.Views.pdf
8.Views.pdf
 
7. Nested Subqueries.pdf
7. Nested Subqueries.pdf7. Nested Subqueries.pdf
7. Nested Subqueries.pdf
 
6. Aggregate Functions.pdf
6. Aggregate Functions.pdf6. Aggregate Functions.pdf
6. Aggregate Functions.pdf
 
5. Basic Structure of SQL Queries.pdf
5. Basic Structure of SQL Queries.pdf5. Basic Structure of SQL Queries.pdf
5. Basic Structure of SQL Queries.pdf
 
4. DML.pdf
4. DML.pdf4. DML.pdf
4. DML.pdf
 
3. DDL.pdf
3. DDL.pdf3. DDL.pdf
3. DDL.pdf
 
2. SQL Introduction.pdf
2. SQL Introduction.pdf2. SQL Introduction.pdf
2. SQL Introduction.pdf
 
1. University Example.pdf
1. University Example.pdf1. University Example.pdf
1. University Example.pdf
 
Assignment12
Assignment12Assignment12
Assignment12
 

Recently uploaded

The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
sachin chaurasia
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
ihlasbinance2003
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
Las Vegas Warehouse
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
enizeyimana36
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
NazakatAliKhoso2
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
zubairahmad848137
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
University of Maribor
 

Recently uploaded (20)

The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
 

Assignment#04

  • 1. Database System Sunita M. Dol Page 1 HANDOUT#04 Aim: Basic SQL: Write simple queries in SQL on the schema created for a specific application. Theory: SQL is based on set and relational operations with certain modifications and enhancements. A typical SQL query has the form: select A1, A2, ..., An from r1, r2, ..., rm where P – Ai represents an attribute, – Ri represents a relation and – P is a predicate. The SELECT Clause The select clause list the attributes desired in the result of a query. SQL allows duplicates in relations as well as in query results. To force the elimination of duplicates, insert the keyword distinct after select. The keyword all specifies that duplicates not be removed. An asterisk in the select clause denotes “all attributes”. The select clause can contain arithmetic expressions involving the operation, +, –, *, and /, and operating on constants or attributes of tuples. The WHERE Clause The where clause specifies conditions that the result must satisfy. Comparison results can be combined using the logical connectives and, or, and not. Comparisons can be applied to results of arithmetic expressions. SQL includes a between comparison operator. The FROM Clause The from clause lists the relations involved in the query. The RENAME Operation The SQL allows renaming relations and attributes using the as clause: old-name as new-name Tuple Variables Tuple variables are defined in the from clause via the use of the as clause. Keyword as is optional and may be omitted borrower as T ≡ borrower T
  • 2. Database System Sunita M. Dol Page 2 String Operations SQL includes a string-matching operator for comparisons on character strings. The operator “like” uses patterns that are described using two special characters: • percent (%). The % character matches any substring. • underscore (_). The _ character matches any character. SQL supports a variety of string operations such as • concatenation (using “||”) • converting from upper to lower case (and vice versa) • Finding string length, extracting substrings, etc. Ordering the display of tuples SQL offers the user some control over the order in which tuples in a relation are displayed. The order by clause causes the tuples in the result of a query to appear in sorted order. We may specify desc for descending order or asc for ascending order, for each attribute; ascending order is the default. Set Operations: The SQL operations union, intersect, and except operate on relations and correspond to the relational-algebra operations ∪, ∩, and −. Like union, intersection, and set difference in relational algebra, the relations participating in the operations must be compatible; that is, they must have the same set of attributes. • In union operation, the number of duplicate tuples in the result is equal to the total number of duplicates that appear in both d and b. Thus, if Jones has three accounts and two loans at the bank, then there will be five tuples with the name Jones in the result. • In intersection operation, the number of duplicate tuples that appear in the result is equal to the minimum number of duplicates in both d and b. Thus, if Jones has three accounts and two loans at the bank, then there will be two tuples with the name Jones in the result. In except operation, the number of duplicate copies of a tuple in the result is equal to the number of duplicate copies of the tuple in d minus the number of duplicate copies of the tuple in b, provided that the difference is positive. Thus, if Jones has three accounts and one loan at the bank, then there will be two tuples with the name Jones in the result. If, instead, this customer has two accounts and three loans at the bank, there will be no tuple with the name Jones in the result. Queries and Output: Select-From-Where Clause Find the names of all branches in the loan relation SQL> select branch_name from loan;
  • 3. Database System Sunita M. Dol Page 3 BRANCH_NAME --------------- Round Hill Downtown Perryridge Perryridge Downtown Redwood Mianus 7 rows selected. List the tuples of loan relation with amount multiplied by 100. SQL> select * from loan; LOAN_NUMBE BRANCH_NAME AMOUNT ---------- --------------- ---------- L-11 Round Hill 900 L-14 Downtown 1500 L-15 Perryridge 1500 L-16 Perryridge 1300 L-17 Downtown 1000 L-23 Redwood 2000 L-93 Mianus 500 7 rows selected. SQL> select loan_number,branch_name,amount*100 from loan; LOAN_NUMBE BRANCH_NAME AMOUNT*100 ---------- --------------- ---------- L-11 Round Hill 90000 L-14 Downtown 150000 L-15 Perryridge 150000 L-16 Perryridge 130000 L-17 Downtown 100000 L-23 Redwood 200000 L-93 Mianus 50000 7 rows selected.
  • 4. Database System Sunita M. Dol Page 4 Find all loan numbers for the loans made at Perryridge branch with amount greater than $1200. SQL> select * from loan; LOAN_NUMBE BRANCH_NAME AMOUNT ---------- --------------- ---------- L-11 Round Hill 900 L-14 Downtown 1500 L-15 Perryridge 1500 L-16 Perryridge 1300 L-17 Downtown 1000 L-23 Redwood 2000 L-93 Mianus 500 7 rows selected. SQL> select loan_number from loan where branch_name='Perryridge' and amount>1200; LOAN_NUMBE ---------- L-15 L-16 Rename Operation SQL> select * from loan; LOAN_NUMBE BRANCH_NAME AMOUNT ---------- --------------- ---------- L-11 Round Hill 900 L-14 Downtown 1500 L-15 Perryridge 1500 L-16 Perryridge 1300 L-17 Downtown 1000 L-23 Redwood 2000 L-93 Mianus 500 7 rows selected. SQL> select customer_name,borrower.loan_number as loan_id,amount 2 from borrower,loan
  • 5. Database System Sunita M. Dol Page 5 3 where borrower.loan_number=loan.loan_number; CUSTOMER_NAME LOAN_ID AMOUNT -------------------- ---------- ---------- Smith L-11 900 Hayes L-15 1500 Adams L-16 1300 Williams L-17 1000 Jones L-17 1000 Smith L-23 2000 Curry L-93 500 7 rows selected. Tuple Variables Find the names of all branches that have assets greater than at least one branch located in Brooklyn. SQL> select * from branch; BRANCH_NAME BRANCH_CITY ASSETS --------------- --------------- ---------- Brighton Brooklyn 7100000 Downtown Brooklyn 9000000 Mianus Horseneck 400000 North Town Rye 3700000 Perryridge Horseneck 1700000 Pownal Bennington 300000 Redwood Palo Alto 2100000 Round Hill Horseneck 8000000 8 rows selected. SQL> select distinct T.branch_name 2 from branch T,branch S 3 where T.assets>S.assets 4 and S.branch_city='Brooklyn'; BRANCH_NAME --------------- Round Hill
  • 6. Database System Sunita M. Dol Page 6 Downtown String Operations Find the names of all customers whose street address includes substring 'Main'. SQL> select * from customer; CUSTOMER_NAME CUSTOMER_STREET -------------------- ------------------------------ CUSTOMER_CITY ------------------------------ Adams Spring Pittsfield Brooks Senator Brooklyn Curry North Rye CUSTOMER_NAME CUSTOMER_STREET -------------------- ------------------------------ CUSTOMER_CITY ------------------------------ Glenn Sand Hill Woodside Green Walnut Stamford Hayes Main Harrison CUSTOMER_NAME CUSTOMER_STREET -------------------- ------------------------------ CUSTOMER_CITY ------------------------------ Johnson Alma Palo Alto
  • 7. Database System Sunita M. Dol Page 7 Jones Main Harrison Lindsay Park Pittsfield CUSTOMER_NAME CUSTOMER_STREET -------------------- ------------------------------ CUSTOMER_CITY ------------------------------ Smith North Rye Turner Putnam Stamford Williams Nassau Princeton 12 rows selected. SQL> select customer_name from customer where customer_street like '%Main%'; CUSTOMER_NAME -------------------- Hayes Jones Ordering the display of tuples List the entire loan relation in descending order of amount.If several loans have the same amount then order them in ascending order by loan number. SQL> select * from loan; LOAN_NUMBE BRANCH_NAME AMOUNT ---------- --------------- ---------- L-11 Round Hill 900
  • 8. Database System Sunita M. Dol Page 8 L-14 Downtown 1500 L-15 Perryridge 1500 L-16 Perryridge 1300 L-17 Downtown 1000 L-23 Redwood 2000 L-93 Mianus 500 7 rows selected. SQL> select * from loan 2 order by amount desc,loan_number asc; LOAN_NUMBE BRANCH_NAME AMOUNT ---------- --------------- ---------- L-23 Redwood 2000 L-14 Downtown 1500 L-15 Perryridge 1500 L-16 Perryridge 1300 L-17 Downtown 1000 L-11 Round Hill 900 L-93 Mianus 500 7 rows selected. Set Operations The set of all customers who have an account at the bank SQL> select * from depositor; CUSTOMER_NAME ACCOUNT_NU -------------------- ---------- Hayes A-102 Johnson A-101 Johnson A-201 Jones A-217 Lindsay A-222 Smith A-215 Turner A-305 7 rows selected.
  • 9. Database System Sunita M. Dol Page 9 SQL> select customer_name from depositor; CUSTOMER_NAME -------------------- Hayes Johnson Johnson Jones Lindsay Smith Turner 7 rows selected. The set of customers who have loan at the bank. SQL> select * from borrower; CUSTOMER_NAME LOAN_NUMBE -------------------- ---------- Adams L-16 Curry L-93 Hayes L-15 Jones L-17 Smith L-11 Smith L-23 Williams L-17 7 rows selected. SQL> select customer_name from borrower; CUSTOMER_NAME -------------------- Adams Curry Hayes Jones Smith Smith Williams
  • 10. Database System Sunita M. Dol Page 10 7 rows selected. Find all the bank customer having loan,an account or both at the bank. SQL> (select customer_name from depositor) 2 union 3 (select customer_name from borrower); CUSTOMER_NAME -------------------- Adams Curry Hayes Johnson Jones Lindsay Smith Turner Williams 9 rows selected. SQL> (select customer_name from depositor) 2 union all 3 (select customer_name from borrower); CUSTOMER_NAME -------------------- Hayes Johnson Johnson Jones Lindsay Smith Turner Adams Curry Hayes Jones
  • 11. Database System Sunita M. Dol Page 11 CUSTOMER_NAME -------------------- Smith Smith Williams 14 rows selected. Find all the bank customer having loan and an account at the bank. SQL> (select customer_name from depositor) 2 intersect 3 (select customer_name from borrower); CUSTOMER_NAME -------------------- Hayes Jones Smith Find all customers who have an account but no loan at the bank. SQL> (select customer_name from depositor) minus (select customer_name from borrower); CUSTOMER_NAME -------------------- Johnson Lindsay Turner Conclusion: We have written simple queries in SQL using • Select-from-where • Rename operation • Tuple variables • String Operation • Ordering the display of tuples • Set operations References:
  • 12. Database System Sunita M. Dol Page 12 • Database system concepts by Abraham Silberschatz, Henry F. Korth, S. Sudarshan (McGraw Hill International Edition) sixth edition. • Database system concepts by Abraham Silberschatz, Henry F. Korth, S. Sudarshan (McGraw Hill International Edition) fifth edition. • http://codex.cs.yale.edu/avi/db-book/db4/slide-dir/ • http://codex.cs.yale.edu/avi/db-book/db5/slide-dir/ • http://codex.cs.yale.edu/avi/db-book/db6/slide-dir/