SlideShare uma empresa Scribd logo
1 de 42
FBW
27-03-2018
Biological Databases
Wim Van Criekinge
SPARQL 1/2
SPARQL 2/2
Prof Devisscher
A Symptoms checker - Disease
B Metabolic engineering
C Cancer Neoantigens
Familienaam Voornaam E-mail Opleidingsprogramma
Davey Lucas Lucas.Davey@UGent.be C CMBIOISB
David Sven Sven.David@UGent.be B IMCELB
Engelen Yanou Yanou.Engelen@UGent.be ? IMCELB
Ezquerro Marrodán Elsa Elsa.EzquerroMarrodan@UGent.be C IXGAEX
Georis Raphaël Raphael.Georis@UGent.be B IMCELB
Gilis Jeroen Jeroen.Gilis@UGent.be B CMBIOISB
Lashkari Samira Samira.Lashakri@UGent.be A CMBIOISB
Recer Karmen Karmen.Recer@UGent.be C IXGAEX
Schindfessel Cédric Cedric.Schindfessel@UGent.be B IMCELB
Silva Marta Marta.Silva@UGent.be B CMBIOISB
Silva Meneses Rodrigo Rodrigo.Meneses@UGent.be C CMBIOISB
Strybol Pieter-Paul PieterPaul.Strybol@UGent.be B/C CMBIOIBE
Taelman Steff Steff.Taelman@UGent.be A CMBIOIBE
Tóth Máté István MateIstvan.Toth@UGent.be C EXGAEX
Toulmé Coralyne Coralyne.Toulme@UGent.be C IXGAEX
Van hoyweghen Sergej Sergej.Vanhoyweghen@UGent.be ? IMCELB
Willems Thomas Thomas.Willems@UGent.be ? IMCELB
Wojciulewitsch Coralie Coralie.Wojciulewitsch@UGent.be A IMCELB
Yekimov Illya Illya.Yekimov@UGent.be A IMCELB
• SELECT Statement
• Advanced SQL
• First database schemes
Selecta Statement (General)
Select componentsb (MySQL version 4.0.X)
1. Select (required)
2. Expression (required)
3. From Table (Only optional if table data is
not used)
4. Where Condition (optional)
5. Group By (optional)
6. Having (optional)
7. Order By (optional)
8. Limit (optional)
aWords listed in blue above are key (reserved) words in MySQL, except
“Expression”
bThere are many more components in the select statement, but only the most
common are discussed
Select
• Is a MySQL keyword at the
beginning of a Structured Query
Language (SQL) statement or more
simply a query that retrieves data
from a database.
• It can be used in conjunction with the
MySQL command insert, replace,
and create table.
Expression
The “expression”
1. Selects which columns (by column name)
will be retrieved
2. Apply MySQL functions on the columns
of data
Examples—
* (Selects all columns in a table)
temperature * 1.8 + 32a
dt, temperature, relative_humidityb
aApply arithmetic operations on a column
bChoose multiple columns in single query
Note: columns are in green, tables are in red,
MySQL functions are in magenta.
Expression Cont
More Examples--
-1 * speed * sin( direction * pi() / 180 )c
-1 * speed * cos( direction * pi() / 180 )
as Vd
avg(temperature)e
tableX.temperature,
tableY.temperaturef
cCan use built in mathematical functions.
dThe ‘as’ keyword can be used to set the output column name.
eCan retrieve a statistical value from rows of data. Must be used with ‘group by’.
fThe select can retrieve or make relationships from multiple tables from a single
query. Note the ‘.’ that separates the table name and column name.
From
Tells MySQL which table(s) to select
froma
aIf multiple tables are used in the
expression, they all must be listed
here seperated by a ‘,’
Where
Sets the condition of which rows to select. Useful
for eliminating unwanted data from your results.
Conditional
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
= Equals
!= Not equals
Logical
and True if both are true
or True if only one is true
() Useful for grouping or
ordering multiple logical
statements
String pattern matching
like a MySQL keyword in-between column and pattern
% a wildcard that matches all instances in a string
_ a wildcard that matches only the character location
Group By
Aggregates rows by distinct values in the columns
listed in the ‘group by’ when using statistical
functions (e.g., avg, std, max, min, sum, count, etc.)
Example--
group by site_ida
group by site_id, month(dt)b
aSingle column
bMultiple columns and apply functions on a column
Having
Similar to where, except that it must follow
‘group by’ group, and only eliminates results
after the results have been aggregated. See
where for more details.
Order By
• Orders the result rows defined by the columns in the
‘order by’ group
• The keyword asc (ascending) and desc (descending)
to change the order of the result rows, and is always
at the end of the order by component. desc is the
default.
Examples—
order by dt
order by dt, site_ida
aThe first column is ordered first, second column is ordered second
on the ordering of the first column, and so on
Order By Example
mysql>select … order by site_id, month asc
site_id month ave_temp
1 1 32.3
1 2 40.2
1 3 49.5
2 1 35.6
2 2 41.3
2 3 53.5
Limit
Limits the number of rows from the result set
limit row_counta
limit offset, row_countb
aStarts at the first row
bStarts at the offset row
Outerjoins
Explicit joins in SQL:
Product(name, category)
Purchase(prodName, store)
Same as:
But Products that never sold will be lost !
SELECT Product.name, Purchase.store
FROM Product JOIN Purchase ON
Product.name = Purchase.prodName
SELECT Product.name, Purchase.store
FROM Product, Purchase
WHERE Product.name = Purchase.prodName
Outer Joins
• Left outer join:
– Include the left tuple even if there’s no
match
• Right outer join:
– Include the right tuple even if there’s no
match
• Full outer join:
– Include the both left and right tuples even
if there’s no match
https://www.w3schools.com/sql/sql_join.asp
Modifying the Database
Three kinds of modifications
• Insertions
• Deletions
• Updates
Sometimes they are all called “updates”
Insertions
General form:
Missing attribute  NULL.
May drop attribute names if give them in order.
INSERT INTO R(A1,…., An) VALUES (v1,…., vn)
INSERT INTO Purchase(buyer, seller, product, store)
VALUES (‘Joe’, ‘Fred’, ‘wakeup-clock-espresso-machine’,
‘The Sharper Image’)
Example: Insert a new purchase to the database:
Insertions
INSERT INTO PRODUCT(name)
SELECT DISTINCT Purchase.product
FROM Purchase
WHERE Purchase.date > “10/26/01”
The query replaces the VALUES keyword.
Here we insert many tuples into PRODUCT
Insertion: an Example
INSERT INTO Product(name)
SELECT DISTINCT prodName
FROM Purchase
WHERE prodName NOT IN (SELECT name FROM Product)
name listPrice category
gizmo 100 Gadgets
camera - -
Deletions
DELETE FROM PURCHASE
WHERE seller = ‘Joe’ AND
product = ‘Brooklyn Bridge’
Factoid about SQL: there is no way to delete only a single
occurrence of a tuple that appears twice
in a relation.
Example:
Updates
UPDATE PRODUCT
SET price = price/2
WHERE Product.name IN
(SELECT product
FROM Purchase
WHERE Date =‘Oct, 25, 1999’);
Example:
Indexes
REALLY important to speed up query processing time.
Suppose we have a relation
Person (name, age, city)
Sequential scan of the file Person may take long
SELECT *
FROM Person
WHERE name = “Smith”
• Create an index on name:
• B+ trees have fan-out of 100s: max 4 levels !
Indexes
Adam Betty Charles …. Smith ….
Creating Indexes
CREATE INDEX nameIndex ON Person(name)
Syntax:
Creating Indexes
Indexes can be created on more than one attribute:
CREATE INDEX doubleindex ON
Person (age, city)
SELECT *
FROM Person
WHERE age = 55 AND city = “Seattle”
SELECT *
FROM Person
WHERE city = “Seattle”
Helps in:
But not in:
Example:
Creating Indexes
Indexes can be useful in range queries too:
B+ trees help in:
Why not create indexes on everything?
CREATE INDEX ageIndex ON Person (age)
SELECT *
FROM Person
WHERE age > 25 AND age < 28
Views are relations, except that they are not physically stored.
For presenting different information to different users
Employee(ssn, name, department, project, salary)
Payroll has access to Employee, others only to Developers
CREATE VIEW Developers AS
SELECT name, project
FROM Employee
WHERE department = “Development”
A Different View
Person(name, city)
Purchase(buyer, seller, product, store)
Product(name, maker, category)
We have a new virtual table:
Seattle-view(buyer, seller, product, store)
CREATE VIEW Seattle-view AS
SELECT buyer, seller, product, store
FROM Person, Purchase
WHERE Person.city = “Seattle” AND
Person.name = Purchase.buyer
A Different View
SELECT name, store
FROM Seattle-view, Product
WHERE Seattle-view.product = Product.name AND
Product.category = “shoes”
We can later use the view:
34
Types of Views
• Virtual views:
– Used in databases
– Computed only on-demand – slower at
runtime
– Always up to date
• Materialized views
– Used in data warehouses
– Precomputed offline – faster at runtime
– May have stale data
Multicore examples
For the project I suggest to take the following
steps (individual or in group - maybe setup a
collaborative tool like slack)
1. What it is about ? What do you want to
achieve ? For who ?
2. identify information resources - think about
a basic data-model
3. Draw (mockup) an interface, don't be
constrained by technical consideration - think
ouside the box:)
2018 03 27_biological_databases_part4_v_upload
2018 03 27_biological_databases_part4_v_upload
2018 03 27_biological_databases_part4_v_upload
2018 03 27_biological_databases_part4_v_upload
2018 03 27_biological_databases_part4_v_upload
2018 03 27_biological_databases_part4_v_upload

Mais conteúdo relacionado

Mais procurados (18)

SPSS How to use Spss software
SPSS How to use Spss softwareSPSS How to use Spss software
SPSS How to use Spss software
 
Intro to SQL by Google's Software Engineer
Intro to SQL by Google's Software EngineerIntro to SQL by Google's Software Engineer
Intro to SQL by Google's Software Engineer
 
Using ddl statements to create and manage tables
Using ddl statements to create and manage tablesUsing ddl statements to create and manage tables
Using ddl statements to create and manage tables
 
T-SQL Data Types (Quick Overview)
T-SQL Data Types (Quick Overview)T-SQL Data Types (Quick Overview)
T-SQL Data Types (Quick Overview)
 
sorting and filtering data in excel
sorting and filtering data in excelsorting and filtering data in excel
sorting and filtering data in excel
 
Introduction to spss 1
Introduction to spss 1Introduction to spss 1
Introduction to spss 1
 
Spss an introduction
Spss  an introductionSpss  an introduction
Spss an introduction
 
Spss tutorial 1
Spss tutorial 1Spss tutorial 1
Spss tutorial 1
 
Advanced Filter Concepts in MS-Excel
Advanced Filter Concepts in MS-ExcelAdvanced Filter Concepts in MS-Excel
Advanced Filter Concepts in MS-Excel
 
Introduction
IntroductionIntroduction
Introduction
 
Spss
SpssSpss
Spss
 
Presentation on spss
Presentation on spssPresentation on spss
Presentation on spss
 
Lesson 5 PP
Lesson 5 PPLesson 5 PP
Lesson 5 PP
 
Intro to JMP for statistics
Intro to JMP for statisticsIntro to JMP for statistics
Intro to JMP for statistics
 
Data entry in Excel and SPSS
Data entry in Excel and SPSS Data entry in Excel and SPSS
Data entry in Excel and SPSS
 
Spss beginners
Spss beginnersSpss beginners
Spss beginners
 
SPS intro
SPS introSPS intro
SPS intro
 
Assignmentdatamining
AssignmentdataminingAssignmentdatamining
Assignmentdatamining
 

Semelhante a 2018 03 27_biological_databases_part4_v_upload

2019 03 05_biological_databases_part5_v_upload
2019 03 05_biological_databases_part5_v_upload2019 03 05_biological_databases_part5_v_upload
2019 03 05_biological_databases_part5_v_uploadProf. Wim Van Criekinge
 
Presentation_BigData_NenaMarin
Presentation_BigData_NenaMarinPresentation_BigData_NenaMarin
Presentation_BigData_NenaMarinn5712036
 
Cassandra Data Modeling
Cassandra Data ModelingCassandra Data Modeling
Cassandra Data ModelingBen Knear
 
Tactical data engineering
Tactical data engineeringTactical data engineering
Tactical data engineeringJulian Hyde
 
Crosstab query techniques
Crosstab query techniquesCrosstab query techniques
Crosstab query techniquesaabaap
 
Data Base Management System Lecture 10.pdf
Data Base Management System Lecture 10.pdfData Base Management System Lecture 10.pdf
Data Base Management System Lecture 10.pdfhowto4ucontact
 
Data Exploration with Apache Drill: Day 2
Data Exploration with Apache Drill: Day 2Data Exploration with Apache Drill: Day 2
Data Exploration with Apache Drill: Day 2Charles Givre
 
EAV Sytem- Magento EAV Model
EAV Sytem- Magento EAV ModelEAV Sytem- Magento EAV Model
EAV Sytem- Magento EAV ModelKhoa Truong Dinh
 
James Colby Maddox Business Intellignece and Computer Science Portfolio
James Colby Maddox Business Intellignece and Computer Science PortfolioJames Colby Maddox Business Intellignece and Computer Science Portfolio
James Colby Maddox Business Intellignece and Computer Science Portfoliocolbydaman
 
Breaking down data silos with the open data protocol
Breaking down data silos with the open data protocolBreaking down data silos with the open data protocol
Breaking down data silos with the open data protocolWoodruff Solutions LLC
 
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007paulguerin
 
AIA101.2.Access Queries Accelerated
AIA101.2.Access Queries AcceleratedAIA101.2.Access Queries Accelerated
AIA101.2.Access Queries AcceleratedDan D'Urso
 

Semelhante a 2018 03 27_biological_databases_part4_v_upload (20)

2019 03 05_biological_databases_part5_v_upload
2019 03 05_biological_databases_part5_v_upload2019 03 05_biological_databases_part5_v_upload
2019 03 05_biological_databases_part5_v_upload
 
Sql server building a database ppt 12
Sql server building a database ppt 12Sql server building a database ppt 12
Sql server building a database ppt 12
 
Presentation_BigData_NenaMarin
Presentation_BigData_NenaMarinPresentation_BigData_NenaMarin
Presentation_BigData_NenaMarin
 
Cassandra Data Modeling
Cassandra Data ModelingCassandra Data Modeling
Cassandra Data Modeling
 
Tactical data engineering
Tactical data engineeringTactical data engineering
Tactical data engineering
 
Crosstab query techniques
Crosstab query techniquesCrosstab query techniques
Crosstab query techniques
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
Data Base Management System Lecture 10.pdf
Data Base Management System Lecture 10.pdfData Base Management System Lecture 10.pdf
Data Base Management System Lecture 10.pdf
 
MySQL Indexes
MySQL IndexesMySQL Indexes
MySQL Indexes
 
Data Exploration with Apache Drill: Day 2
Data Exploration with Apache Drill: Day 2Data Exploration with Apache Drill: Day 2
Data Exploration with Apache Drill: Day 2
 
EAV Sytem- Magento EAV Model
EAV Sytem- Magento EAV ModelEAV Sytem- Magento EAV Model
EAV Sytem- Magento EAV Model
 
PPT
PPTPPT
PPT
 
James Colby Maddox Business Intellignece and Computer Science Portfolio
James Colby Maddox Business Intellignece and Computer Science PortfolioJames Colby Maddox Business Intellignece and Computer Science Portfolio
James Colby Maddox Business Intellignece and Computer Science Portfolio
 
Sql
SqlSql
Sql
 
Breaking down data silos with the open data protocol
Breaking down data silos with the open data protocolBreaking down data silos with the open data protocol
Breaking down data silos with the open data protocol
 
Module 3
Module 3Module 3
Module 3
 
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007
 
unit 1 ppt.pptx
unit 1 ppt.pptxunit 1 ppt.pptx
unit 1 ppt.pptx
 
AIA101.2.Access Queries Accelerated
AIA101.2.Access Queries AcceleratedAIA101.2.Access Queries Accelerated
AIA101.2.Access Queries Accelerated
 
DBMS LAB M.docx
DBMS LAB M.docxDBMS LAB M.docx
DBMS LAB M.docx
 

Mais de Prof. Wim Van Criekinge

2019 03 05_biological_databases_part4_v_upload
2019 03 05_biological_databases_part4_v_upload2019 03 05_biological_databases_part4_v_upload
2019 03 05_biological_databases_part4_v_uploadProf. Wim Van Criekinge
 
2019 03 05_biological_databases_part3_v_upload
2019 03 05_biological_databases_part3_v_upload2019 03 05_biological_databases_part3_v_upload
2019 03 05_biological_databases_part3_v_uploadProf. Wim Van Criekinge
 
2019 02 21_biological_databases_part2_v_upload
2019 02 21_biological_databases_part2_v_upload2019 02 21_biological_databases_part2_v_upload
2019 02 21_biological_databases_part2_v_uploadProf. Wim Van Criekinge
 
2019 02 12_biological_databases_part1_v_upload
2019 02 12_biological_databases_part1_v_upload2019 02 12_biological_databases_part1_v_upload
2019 02 12_biological_databases_part1_v_uploadProf. Wim Van Criekinge
 
Bio ontologies and semantic technologies[2]
Bio ontologies and semantic technologies[2]Bio ontologies and semantic technologies[2]
Bio ontologies and semantic technologies[2]Prof. Wim Van Criekinge
 
2018 02 20_biological_databases_part1_v_upload
2018 02 20_biological_databases_part1_v_upload2018 02 20_biological_databases_part1_v_upload
2018 02 20_biological_databases_part1_v_uploadProf. Wim Van Criekinge
 

Mais de Prof. Wim Van Criekinge (20)

2020 02 11_biological_databases_part1
2020 02 11_biological_databases_part12020 02 11_biological_databases_part1
2020 02 11_biological_databases_part1
 
2019 03 05_biological_databases_part4_v_upload
2019 03 05_biological_databases_part4_v_upload2019 03 05_biological_databases_part4_v_upload
2019 03 05_biological_databases_part4_v_upload
 
2019 03 05_biological_databases_part3_v_upload
2019 03 05_biological_databases_part3_v_upload2019 03 05_biological_databases_part3_v_upload
2019 03 05_biological_databases_part3_v_upload
 
2019 02 21_biological_databases_part2_v_upload
2019 02 21_biological_databases_part2_v_upload2019 02 21_biological_databases_part2_v_upload
2019 02 21_biological_databases_part2_v_upload
 
2019 02 12_biological_databases_part1_v_upload
2019 02 12_biological_databases_part1_v_upload2019 02 12_biological_databases_part1_v_upload
2019 02 12_biological_databases_part1_v_upload
 
P7 2018 biopython3
P7 2018 biopython3P7 2018 biopython3
P7 2018 biopython3
 
P6 2018 biopython2b
P6 2018 biopython2bP6 2018 biopython2b
P6 2018 biopython2b
 
P4 2018 io_functions
P4 2018 io_functionsP4 2018 io_functions
P4 2018 io_functions
 
P3 2018 python_regexes
P3 2018 python_regexesP3 2018 python_regexes
P3 2018 python_regexes
 
T1 2018 bioinformatics
T1 2018 bioinformaticsT1 2018 bioinformatics
T1 2018 bioinformatics
 
P1 2018 python
P1 2018 pythonP1 2018 python
P1 2018 python
 
Bio ontologies and semantic technologies[2]
Bio ontologies and semantic technologies[2]Bio ontologies and semantic technologies[2]
Bio ontologies and semantic technologies[2]
 
2018 05 08_biological_databases_no_sql
2018 05 08_biological_databases_no_sql2018 05 08_biological_databases_no_sql
2018 05 08_biological_databases_no_sql
 
2018 03 20_biological_databases_part3
2018 03 20_biological_databases_part32018 03 20_biological_databases_part3
2018 03 20_biological_databases_part3
 
2018 02 20_biological_databases_part1_v_upload
2018 02 20_biological_databases_part1_v_upload2018 02 20_biological_databases_part1_v_upload
2018 02 20_biological_databases_part1_v_upload
 
P7 2017 biopython3
P7 2017 biopython3P7 2017 biopython3
P7 2017 biopython3
 
P6 2017 biopython2
P6 2017 biopython2P6 2017 biopython2
P6 2017 biopython2
 
Van criekinge 2017_11_13_rodebiotech
Van criekinge 2017_11_13_rodebiotechVan criekinge 2017_11_13_rodebiotech
Van criekinge 2017_11_13_rodebiotech
 
P4 2017 io
P4 2017 ioP4 2017 io
P4 2017 io
 
T5 2017 database_searching_v_upload
T5 2017 database_searching_v_uploadT5 2017 database_searching_v_upload
T5 2017 database_searching_v_upload
 

Último

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 

Último (20)

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 

2018 03 27_biological_databases_part4_v_upload

  • 1.
  • 4. A Symptoms checker - Disease B Metabolic engineering C Cancer Neoantigens Familienaam Voornaam E-mail Opleidingsprogramma Davey Lucas Lucas.Davey@UGent.be C CMBIOISB David Sven Sven.David@UGent.be B IMCELB Engelen Yanou Yanou.Engelen@UGent.be ? IMCELB Ezquerro Marrodán Elsa Elsa.EzquerroMarrodan@UGent.be C IXGAEX Georis Raphaël Raphael.Georis@UGent.be B IMCELB Gilis Jeroen Jeroen.Gilis@UGent.be B CMBIOISB Lashkari Samira Samira.Lashakri@UGent.be A CMBIOISB Recer Karmen Karmen.Recer@UGent.be C IXGAEX Schindfessel Cédric Cedric.Schindfessel@UGent.be B IMCELB Silva Marta Marta.Silva@UGent.be B CMBIOISB Silva Meneses Rodrigo Rodrigo.Meneses@UGent.be C CMBIOISB Strybol Pieter-Paul PieterPaul.Strybol@UGent.be B/C CMBIOIBE Taelman Steff Steff.Taelman@UGent.be A CMBIOIBE Tóth Máté István MateIstvan.Toth@UGent.be C EXGAEX Toulmé Coralyne Coralyne.Toulme@UGent.be C IXGAEX Van hoyweghen Sergej Sergej.Vanhoyweghen@UGent.be ? IMCELB Willems Thomas Thomas.Willems@UGent.be ? IMCELB Wojciulewitsch Coralie Coralie.Wojciulewitsch@UGent.be A IMCELB Yekimov Illya Illya.Yekimov@UGent.be A IMCELB
  • 5. • SELECT Statement • Advanced SQL • First database schemes
  • 6. Selecta Statement (General) Select componentsb (MySQL version 4.0.X) 1. Select (required) 2. Expression (required) 3. From Table (Only optional if table data is not used) 4. Where Condition (optional) 5. Group By (optional) 6. Having (optional) 7. Order By (optional) 8. Limit (optional) aWords listed in blue above are key (reserved) words in MySQL, except “Expression” bThere are many more components in the select statement, but only the most common are discussed
  • 7. Select • Is a MySQL keyword at the beginning of a Structured Query Language (SQL) statement or more simply a query that retrieves data from a database. • It can be used in conjunction with the MySQL command insert, replace, and create table.
  • 8. Expression The “expression” 1. Selects which columns (by column name) will be retrieved 2. Apply MySQL functions on the columns of data Examples— * (Selects all columns in a table) temperature * 1.8 + 32a dt, temperature, relative_humidityb aApply arithmetic operations on a column bChoose multiple columns in single query Note: columns are in green, tables are in red, MySQL functions are in magenta.
  • 9. Expression Cont More Examples-- -1 * speed * sin( direction * pi() / 180 )c -1 * speed * cos( direction * pi() / 180 ) as Vd avg(temperature)e tableX.temperature, tableY.temperaturef cCan use built in mathematical functions. dThe ‘as’ keyword can be used to set the output column name. eCan retrieve a statistical value from rows of data. Must be used with ‘group by’. fThe select can retrieve or make relationships from multiple tables from a single query. Note the ‘.’ that separates the table name and column name.
  • 10. From Tells MySQL which table(s) to select froma aIf multiple tables are used in the expression, they all must be listed here seperated by a ‘,’
  • 11. Where Sets the condition of which rows to select. Useful for eliminating unwanted data from your results. Conditional > Greater than < Less than >= Greater than or equal to <= Less than or equal to = Equals != Not equals Logical and True if both are true or True if only one is true () Useful for grouping or ordering multiple logical statements String pattern matching like a MySQL keyword in-between column and pattern % a wildcard that matches all instances in a string _ a wildcard that matches only the character location
  • 12. Group By Aggregates rows by distinct values in the columns listed in the ‘group by’ when using statistical functions (e.g., avg, std, max, min, sum, count, etc.) Example-- group by site_ida group by site_id, month(dt)b aSingle column bMultiple columns and apply functions on a column
  • 13. Having Similar to where, except that it must follow ‘group by’ group, and only eliminates results after the results have been aggregated. See where for more details.
  • 14. Order By • Orders the result rows defined by the columns in the ‘order by’ group • The keyword asc (ascending) and desc (descending) to change the order of the result rows, and is always at the end of the order by component. desc is the default. Examples— order by dt order by dt, site_ida aThe first column is ordered first, second column is ordered second on the ordering of the first column, and so on
  • 15. Order By Example mysql>select … order by site_id, month asc site_id month ave_temp 1 1 32.3 1 2 40.2 1 3 49.5 2 1 35.6 2 2 41.3 2 3 53.5
  • 16. Limit Limits the number of rows from the result set limit row_counta limit offset, row_countb aStarts at the first row bStarts at the offset row
  • 17. Outerjoins Explicit joins in SQL: Product(name, category) Purchase(prodName, store) Same as: But Products that never sold will be lost ! SELECT Product.name, Purchase.store FROM Product JOIN Purchase ON Product.name = Purchase.prodName SELECT Product.name, Purchase.store FROM Product, Purchase WHERE Product.name = Purchase.prodName
  • 18. Outer Joins • Left outer join: – Include the left tuple even if there’s no match • Right outer join: – Include the right tuple even if there’s no match • Full outer join: – Include the both left and right tuples even if there’s no match
  • 20. Modifying the Database Three kinds of modifications • Insertions • Deletions • Updates Sometimes they are all called “updates”
  • 21. Insertions General form: Missing attribute  NULL. May drop attribute names if give them in order. INSERT INTO R(A1,…., An) VALUES (v1,…., vn) INSERT INTO Purchase(buyer, seller, product, store) VALUES (‘Joe’, ‘Fred’, ‘wakeup-clock-espresso-machine’, ‘The Sharper Image’) Example: Insert a new purchase to the database:
  • 22. Insertions INSERT INTO PRODUCT(name) SELECT DISTINCT Purchase.product FROM Purchase WHERE Purchase.date > “10/26/01” The query replaces the VALUES keyword. Here we insert many tuples into PRODUCT
  • 23. Insertion: an Example INSERT INTO Product(name) SELECT DISTINCT prodName FROM Purchase WHERE prodName NOT IN (SELECT name FROM Product) name listPrice category gizmo 100 Gadgets camera - -
  • 24. Deletions DELETE FROM PURCHASE WHERE seller = ‘Joe’ AND product = ‘Brooklyn Bridge’ Factoid about SQL: there is no way to delete only a single occurrence of a tuple that appears twice in a relation. Example:
  • 25. Updates UPDATE PRODUCT SET price = price/2 WHERE Product.name IN (SELECT product FROM Purchase WHERE Date =‘Oct, 25, 1999’); Example:
  • 26. Indexes REALLY important to speed up query processing time. Suppose we have a relation Person (name, age, city) Sequential scan of the file Person may take long SELECT * FROM Person WHERE name = “Smith”
  • 27. • Create an index on name: • B+ trees have fan-out of 100s: max 4 levels ! Indexes Adam Betty Charles …. Smith ….
  • 28. Creating Indexes CREATE INDEX nameIndex ON Person(name) Syntax:
  • 29. Creating Indexes Indexes can be created on more than one attribute: CREATE INDEX doubleindex ON Person (age, city) SELECT * FROM Person WHERE age = 55 AND city = “Seattle” SELECT * FROM Person WHERE city = “Seattle” Helps in: But not in: Example:
  • 30. Creating Indexes Indexes can be useful in range queries too: B+ trees help in: Why not create indexes on everything? CREATE INDEX ageIndex ON Person (age) SELECT * FROM Person WHERE age > 25 AND age < 28
  • 31. Views are relations, except that they are not physically stored. For presenting different information to different users Employee(ssn, name, department, project, salary) Payroll has access to Employee, others only to Developers CREATE VIEW Developers AS SELECT name, project FROM Employee WHERE department = “Development”
  • 32. A Different View Person(name, city) Purchase(buyer, seller, product, store) Product(name, maker, category) We have a new virtual table: Seattle-view(buyer, seller, product, store) CREATE VIEW Seattle-view AS SELECT buyer, seller, product, store FROM Person, Purchase WHERE Person.city = “Seattle” AND Person.name = Purchase.buyer
  • 33. A Different View SELECT name, store FROM Seattle-view, Product WHERE Seattle-view.product = Product.name AND Product.category = “shoes” We can later use the view:
  • 34. 34 Types of Views • Virtual views: – Used in databases – Computed only on-demand – slower at runtime – Always up to date • Materialized views – Used in data warehouses – Precomputed offline – faster at runtime – May have stale data
  • 36. For the project I suggest to take the following steps (individual or in group - maybe setup a collaborative tool like slack) 1. What it is about ? What do you want to achieve ? For who ? 2. identify information resources - think about a basic data-model 3. Draw (mockup) an interface, don't be constrained by technical consideration - think ouside the box:)