Book contents
- Frontmatter
- Contents
- Preface
- Acknowledgements
- 1 Prologue
- 2 A beginners’ guide
- 3 Python basics
- 4 Program control and logic
- 5 Functions
- 6 Files
- 7 Object orientation
- 8 Object data modelling
- 9 Mathematics
- 10 Coding tips
- 11 Biological sequences
- 12 Pairwise sequence alignments
- 13 Multiple-sequence alignments
- 14 Sequence variation and evolution
- 15 Macromolecular structures
- 16 Array data
- 17 High-throughput sequence analyses
- 18 Images
- 19 Signal processing
- 20 Databases
- 21 Probability
- 22 Statistics
- 23 Clustering and discrimination
- 24 Machine learning
- 25 Hard problems
- 26 Graphical interfaces
- 27 Improving speed
- Appendices
- Glossary
- Index
- Plate section
20 - Databases
Published online by Cambridge University Press: 05 February 2015
- Frontmatter
- Contents
- Preface
- Acknowledgements
- 1 Prologue
- 2 A beginners’ guide
- 3 Python basics
- 4 Program control and logic
- 5 Functions
- 6 Files
- 7 Object orientation
- 8 Object data modelling
- 9 Mathematics
- 10 Coding tips
- 11 Biological sequences
- 12 Pairwise sequence alignments
- 13 Multiple-sequence alignments
- 14 Sequence variation and evolution
- 15 Macromolecular structures
- 16 Array data
- 17 High-throughput sequence analyses
- 18 Images
- 19 Signal processing
- 20 Databases
- 21 Probability
- 22 Statistics
- 23 Clustering and discrimination
- 24 Machine learning
- 25 Hard problems
- 26 Graphical interfaces
- 27 Improving speed
- Appendices
- Glossary
- Index
- Plate section
Summary
A brief introduction to relational databases
Any collection of data can be considered to be a database, however it is stored or utilised. However, the common use of the word ‘database’ usually refers to a relational database. Relational databases were introduced in the 1970s and model their data in terms of tables with rows and columns. There is an associated language, SQL (Structured Query Language), that can be used to send messages to the database to allow the database to be queried and modified: inserting, changing and deleting data elements. SQL also provides the ability to make connections between the data in different tables. In terms of mathematics, relational databases can be thought of as ‘first-order predicate logic’, and this mathematical underpinning of the principles of relational databases is one reason they are conceptually attractive.
Tables
A table in a relational database has a name and also has some named columns and each row in the table represents one record of data. The type of the data in each column can be specified and the data in any column can be stated to be mandatory, or not. One or more columns in each table define the key. Each record in the table must have a unique key; the key identifies the individual record. Sometimes a table has a ‘natural’ key but sometimes there is no obvious key and so instead a counter (a ‘serial’ or ‘ID’ number) is used, which is set (in many database implementations automatically) to 1 for the first record, 2 for the second, etc. At a simplistic level, spreadsheets (e.g. as used in Excel) can be thought of as tables in a weak substitute for a relational database. A table can have one or more columns that refer to one or more other tables, and this is a way that information between tables can be linked. In the database jargon, a query that involves relating information across more than one table is called a join.
- Type
- Chapter
- Information
- Python Programming for BiologyBioinformatics and Beyond, pp. 401 - 420Publisher: Cambridge University PressPrint publication year: 2015