<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=LibreOffice-Suite-Base%2FC4%2FDatabase-Design-Primary-Key-and-Relationships%2FEnglish</id>
		<title>LibreOffice-Suite-Base/C4/Database-Design-Primary-Key-and-Relationships/English - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=LibreOffice-Suite-Base%2FC4%2FDatabase-Design-Primary-Key-and-Relationships%2FEnglish"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=LibreOffice-Suite-Base/C4/Database-Design-Primary-Key-and-Relationships/English&amp;action=history"/>
		<updated>2026-05-13T01:26:57Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=LibreOffice-Suite-Base/C4/Database-Design-Primary-Key-and-Relationships/English&amp;diff=856&amp;oldid=prev</id>
		<title>Pravin1389: moved LibreOffice-Suite-Base/C4/Database-Design-Primary-Key-and-Relationships /English to LibreOffice-Suite-Base/C4/Database-Design-Primary-Key-and-Relationships/English</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=LibreOffice-Suite-Base/C4/Database-Design-Primary-Key-and-Relationships/English&amp;diff=856&amp;oldid=prev"/>
				<updated>2012-12-01T14:27:47Z</updated>
		
		<summary type="html">&lt;p&gt;moved &lt;a href=&quot;/index.php/LibreOffice-Suite-Base/C4/Database-Design-Primary-Key-and-Relationships_/English&quot; class=&quot;mw-redirect&quot; title=&quot;LibreOffice-Suite-Base/C4/Database-Design-Primary-Key-and-Relationships /English&quot;&gt;LibreOffice-Suite-Base/C4/Database-Design-Primary-Key-and-Relationships /English&lt;/a&gt; to &lt;a href=&quot;/index.php/LibreOffice-Suite-Base/C4/Database-Design-Primary-Key-and-Relationships/English&quot; title=&quot;LibreOffice-Suite-Base/C4/Database-Design-Primary-Key-and-Relationships/English&quot;&gt;LibreOffice-Suite-Base/C4/Database-Design-Primary-Key-and-Relationships/English&lt;/a&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 14:27, 1 December 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Pravin1389</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=LibreOffice-Suite-Base/C4/Database-Design-Primary-Key-and-Relationships/English&amp;diff=331&amp;oldid=prev</id>
		<title>Chandrika: Created page with '{| border=1 !Visual Cue !Narration |- |Show Slide Number 1 Spoken tutorial on LibreOffice Base Database Design : 2  Learning Objectives  Database Design: 2 (continuation of Datab…'</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=LibreOffice-Suite-Base/C4/Database-Design-Primary-Key-and-Relationships/English&amp;diff=331&amp;oldid=prev"/>
				<updated>2012-11-27T15:26:37Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;{| border=1 !Visual Cue !Narration |- |Show Slide Number 1 Spoken tutorial on LibreOffice Base Database Design : 2  Learning Objectives  Database Design: 2 (continuation of Datab…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|Show Slide Number 1&lt;br /&gt;
Spoken tutorial on LibreOffice Base Database Design : 2&lt;br /&gt;
&lt;br /&gt;
Learning Objectives&lt;br /&gt;
&lt;br /&gt;
Database Design: 2 (continuation of Database Design: Part 1)&lt;br /&gt;
&lt;br /&gt;
4. Turn information items into columns&lt;br /&gt;
&lt;br /&gt;
5. Specify primary keys&lt;br /&gt;
&lt;br /&gt;
6. Set up the table relationships&lt;br /&gt;
|Welcome to the Spoken tutorial on LibreOffice Base.&lt;br /&gt;
&lt;br /&gt;
This tutorial is a continuation of the previous tutorial on Database Design.&lt;br /&gt;
&lt;br /&gt;
And we will learn the following topics here:&lt;br /&gt;
&lt;br /&gt;
4. Turn information items into columns&lt;br /&gt;
&lt;br /&gt;
5. Specify primary keys&lt;br /&gt;
&lt;br /&gt;
6. Set up the table relationships&lt;br /&gt;
|-&lt;br /&gt;
|Show Slide Number 2&lt;br /&gt;
Database Design Process&lt;br /&gt;
&lt;br /&gt;
Step 1. Determine the purpose of our database    &lt;br /&gt;
&lt;br /&gt;
Step 2. Find and organize the information required     &lt;br /&gt;
&lt;br /&gt;
Step 3. Divide the information into tables    &lt;br /&gt;
&lt;br /&gt;
Step 4. Turn information items into columns    &lt;br /&gt;
|In the last tutorial, we started the process of database design for a simple Library application.&lt;br /&gt;
&lt;br /&gt;
We first determined the purpose of building the Library database. &lt;br /&gt;
&lt;br /&gt;
Then we continued the process by finding and organizing the information about the library and &lt;br /&gt;
&lt;br /&gt;
we divided the information into Tables. &lt;br /&gt;
&lt;br /&gt;
And so, we had identified four tables in our Library database: Books, Authors, Publications and Members.&lt;br /&gt;
&lt;br /&gt;
Let us now go to the next step, which is turning the information items into columns.    &lt;br /&gt;
&lt;br /&gt;
Here, we will decide which information item we want to store in each table. &lt;br /&gt;
|-&lt;br /&gt;
|Show Slide Number 3&lt;br /&gt;
&lt;br /&gt;
Show BooksAuthorsPublishersTableDataNoId.ppt&lt;br /&gt;
&lt;br /&gt;
Show cursor movements over the slide as narration goes forward.&lt;br /&gt;
|Each information item which we identified earlier, becomes a field, and is displayed as a column in the table.&lt;br /&gt;
&lt;br /&gt;
As shown in the image on the screen, the Books table has 5 columns which are also called fields.&lt;br /&gt;
&lt;br /&gt;
So each row or record here contains information about exactly one book in its columns.&lt;br /&gt;
&lt;br /&gt;
Similarly, each record in the Authors table contains information about just one author. &lt;br /&gt;
&lt;br /&gt;
And each record in the Publishers table contains information about just one publisher. &lt;br /&gt;
|-&lt;br /&gt;
|Show Slide Number 4&lt;br /&gt;
&lt;br /&gt;
Step 4. Turn information items into columns    &lt;br /&gt;
&lt;br /&gt;
Refine columns based on requirements&lt;br /&gt;
&lt;br /&gt;
Splitting the Author name into First Name and Last Name, helps to search or sort by these columns. &lt;br /&gt;
&lt;br /&gt;
No need to store results of calculations as separate columns in tables, as Base can perform the calculations whenever we want to see the results.&lt;br /&gt;
|Now, we can further refine the columns based on our requirements. &lt;br /&gt;
&lt;br /&gt;
For example, we can split the Author name into First Name and Last Name, so that we can search or sort by these columns. &lt;br /&gt;
&lt;br /&gt;
And we don’t have to store results of calculations as separate columns in tables &lt;br /&gt;
&lt;br /&gt;
because Base can perform the calculations whenever we want to see the results.&lt;br /&gt;
|-&lt;br /&gt;
|Show Slide Number 5&lt;br /&gt;
&lt;br /&gt;
Step 5. Specify primary keys&lt;br /&gt;
&lt;br /&gt;
Primary key of a table is a column or set of columns that uniquely identifies each row stored in the table. &lt;br /&gt;
&lt;br /&gt;
This is often a unique identification number, such as a Book Id or an Author Id.&lt;br /&gt;
&lt;br /&gt;
With primary key fields we can quickly associate logically related data from multiple tables and bring the data together&lt;br /&gt;
&lt;br /&gt;
* Primary key does not allow duplicate values.&lt;br /&gt;
&lt;br /&gt;
* Do not use names for primary keys, as two people can share the same name.&lt;br /&gt;
&lt;br /&gt;
* A primary key should always have a value. &lt;br /&gt;
&lt;br /&gt;
* If it is empty or Null, then we can’t consider it a primary key. &lt;br /&gt;
&lt;br /&gt;
* We can force a primary key column to have a value always.&lt;br /&gt;
&lt;br /&gt;
* Base supports the ‘AutoNumber’ data type&lt;br /&gt;
|Now that we are clear about tables and columns, let us see how we can specify primary keys next.&lt;br /&gt;
&lt;br /&gt;
What is a primary key? &lt;br /&gt;
&lt;br /&gt;
Each table should include a column or a set of columns that uniquely identifies each row stored in the table. &lt;br /&gt;
&lt;br /&gt;
This column or set of columns is the primary key of the table. &lt;br /&gt;
&lt;br /&gt;
This is often a unique identification number, such as a Book Id or an Author Id.&lt;br /&gt;
&lt;br /&gt;
We can use the primary key fields is to quickly associate logically related data from multiple tables and bring the data together for us.&lt;br /&gt;
&lt;br /&gt;
And we cannot have duplicate values in a primary key. &lt;br /&gt;
&lt;br /&gt;
For example, we cannot use people’s names as a primary key, because names are not unique. &lt;br /&gt;
&lt;br /&gt;
There can be two people with the same name in the same table.&lt;br /&gt;
	&lt;br /&gt;
Next, a primary key should always have a value. &lt;br /&gt;
&lt;br /&gt;
If it is empty or Null, then we cannot consider it a primary key. &lt;br /&gt;
&lt;br /&gt;
And we can force a primary key column to have a value always by setting the column’s data type as an ‘AutoNumber’ which Base will generate automatically.&lt;br /&gt;
|-&lt;br /&gt;
|Show Slide Number 6&lt;br /&gt;
&lt;br /&gt;
Show BooksAuthorsPublishersTableDataWithId.ppt&lt;br /&gt;
&lt;br /&gt;
Show cursor movements over the slide as narration goes forward.&lt;br /&gt;
|As shown in the image on the screen, we can set up the primary keys for our tables as follows:&lt;br /&gt;
&lt;br /&gt;
BookId for Books table, &lt;br /&gt;
&lt;br /&gt;
AuthorId for Authors table, &lt;br /&gt;
&lt;br /&gt;
PublishersId for Publishers table &lt;br /&gt;
&lt;br /&gt;
Similarly, though not shown here, MemberId will be the primary key for the Members table.&lt;br /&gt;
|-&lt;br /&gt;
|Go back to Slide Number 5&lt;br /&gt;
&lt;br /&gt;
Retain slide 5 content. And make the following appear:&lt;br /&gt;
&lt;br /&gt;
Base forbids use of null values in primary key columns and that enforces Entity Integrity.&lt;br /&gt;
|Finally, by setting up the primary keys in the tables, we are enforcing Entity Integrity.&lt;br /&gt;
&lt;br /&gt;
Entity Integrity ensures that there are no duplicate records within the table. &lt;br /&gt;
&lt;br /&gt;
It also ensures that the field that identifies each record within the table is unique and never null. &lt;br /&gt;
|-&lt;br /&gt;
|Show Slide Number 7&lt;br /&gt;
&lt;br /&gt;
Step 6. Set up the table relationships&lt;br /&gt;
&lt;br /&gt;
* Base is called a Relational Database Management System (RDBMS), as it supports setting up of table relations&lt;br /&gt;
&lt;br /&gt;
* One-to-Many Relationship&lt;br /&gt;
|Now that we have the primary keys in the three tables, we can bring them all together by setting up the relationships. &lt;br /&gt;
&lt;br /&gt;
Since Base supports this concept, Base is called a Relational Database Management System, RDBMS in short.&lt;br /&gt;
&lt;br /&gt;
There are a few types of relationships and we’ll see them now.&lt;br /&gt;
&lt;br /&gt;
First we will see what a One-to-Many relationship is. &lt;br /&gt;
|-&lt;br /&gt;
|Show Slide Number 6 again&lt;br /&gt;
&lt;br /&gt;
Show BooksAuthorsPublishersTableDataWithId.ppt&lt;br /&gt;
&lt;br /&gt;
Show cursor movements over the slide as narration goes forward.&lt;br /&gt;
|Let us consider the Books and the Authors tables in the image shown now.&lt;br /&gt;
&lt;br /&gt;
A book is written by exactly one author. &lt;br /&gt;
&lt;br /&gt;
Now, there are cases where two or several people co-author a single book.&lt;br /&gt;
&lt;br /&gt;
But we will limit our example to just one person authoring one book.&lt;br /&gt;
&lt;br /&gt;
Continuing on with our example, an author can write several books. &lt;br /&gt;
&lt;br /&gt;
So for one author represented in the Authors table, there can be many books represented in the Books table written by the author. &lt;br /&gt;
&lt;br /&gt;
This is therefore, a one-to-many relationship.&lt;br /&gt;
|-&lt;br /&gt;
|Show Slide Number 8&lt;br /&gt;
&lt;br /&gt;
Show BooksAuthorsPublishersTableDataWithIdForeignKeys.ppt&lt;br /&gt;
&lt;br /&gt;
Show cursor movements over the slide as narration goes forward.&lt;br /&gt;
|And we can represent this in our Library database&lt;br /&gt;
&lt;br /&gt;
By taking the Author Id which is the primary key in the Authors table and adding it to the Books table. Simple.&lt;br /&gt;
&lt;br /&gt;
So the Author Id in the Books table is called the Foreign key. &lt;br /&gt;
&lt;br /&gt;
Similarly the Publisher Id which is a primary key in the Publishers table becomes the foreign key in the Books table by adding it there. &lt;br /&gt;
|-&lt;br /&gt;
|Show Slide Number 7 again.&lt;br /&gt;
&lt;br /&gt;
Retain slide 7 content. And make the following appear:&lt;br /&gt;
&lt;br /&gt;
* One-to-Many Relationship can be represented by sharing a column or a set of columns between two tables&lt;br /&gt;
&lt;br /&gt;
* Table relationships are set up using Foreign keys &lt;br /&gt;
&lt;br /&gt;
* A Primary Key in a table can be represented as a Foreign Key in a second table to establish the relationship.&lt;br /&gt;
&lt;br /&gt;
* Referential Integrity: every foreign key value in a table will have a matching primary key value in the related tables.&lt;br /&gt;
|So by sharing a column or a set of columns, we can represent one-to-many relationships in the database.&lt;br /&gt;
&lt;br /&gt;
And table relationships can be set up using the Foreign keys.&lt;br /&gt;
&lt;br /&gt;
So a primary key in a table can be represented as a foreign key in a second table to establish the relationship.&lt;br /&gt;
&lt;br /&gt;
Thereby we enforce Referential integrity. &lt;br /&gt;
&lt;br /&gt;
Meaning, every foreign key value in a table will have a matching primary key value in the related tables.&lt;br /&gt;
|-&lt;br /&gt;
|Show Slide Number 9&lt;br /&gt;
&lt;br /&gt;
Show BooksMembersDesignWithId.ppt&lt;br /&gt;
&lt;br /&gt;
Show cursor movements over the slide as narration goes forward.&lt;br /&gt;
|Next, let us see what a Many-to-Many relationship is.&lt;br /&gt;
&lt;br /&gt;
Let us go back to the table design now.&lt;br /&gt;
&lt;br /&gt;
A book can be issued to any number of library members, (considering there are many copies available). &lt;br /&gt;
&lt;br /&gt;
Similarly a member can borrow any number of books (of course, considering, books are available).&lt;br /&gt;
|-&lt;br /&gt;
|Show Slide Number 10&lt;br /&gt;
&lt;br /&gt;
Show Many-Manyrelationship.ppt&lt;br /&gt;
&lt;br /&gt;
Show cursor movements over the slide as narration goes forward.&lt;br /&gt;
|So here we have an example of multiple books being issued to multiple members &lt;br /&gt;
&lt;br /&gt;
which represents a Many-to-many relationship.&lt;br /&gt;
&lt;br /&gt;
So we can represent this many-to-many relationship in our database&lt;br /&gt;
&lt;br /&gt;
by creating a third table, BooksIssued table, which is also called a Junction table. &lt;br /&gt;
&lt;br /&gt;
And here, we will insert the primary keys from each of the two tables - Books and Members, into the BooksIssued table. &lt;br /&gt;
&lt;br /&gt;
As a result, the BooksIssued table records each book issued to a member.&lt;br /&gt;
|-&lt;br /&gt;
|Show Slide Number 7 again.&lt;br /&gt;
&lt;br /&gt;
Retain slide 7 content. And make the following appear:&lt;br /&gt;
&lt;br /&gt;
* Many-to-Many relationships can be represented in the database, by creating a third junction table&lt;br /&gt;
&lt;br /&gt;
* The Junction table will have the primary key fields from each of the related tables.&lt;br /&gt;
|So by creating a third junction table, we can represent many-to-many relationships.&lt;br /&gt;
|-&lt;br /&gt;
|Show Slide Number 7 again.&lt;br /&gt;
&lt;br /&gt;
Retain slide 7 content. And make the following appear:&lt;br /&gt;
&lt;br /&gt;
* One-to-one relationship&lt;br /&gt;
&lt;br /&gt;
* It is represented when there are rarely used attributes/columns in a table. These can be moved to a new supplemental table with the primary key being the same as in the main table.&lt;br /&gt;
&lt;br /&gt;
* Each record in the supplemental table will correspond to exactly one record in the main table.&lt;br /&gt;
|And finally there is the One-to-one relationship. &lt;br /&gt;
&lt;br /&gt;
Sometimes, some attributes or columns are specific to certain data only and so are rarely filled up with data.&lt;br /&gt;
&lt;br /&gt;
Let us consider the case where only one author has a website address and the rest of them do not.&lt;br /&gt;
&lt;br /&gt;
And leaving the new website column in the Authors table mostly empty, will consume disk space.&lt;br /&gt;
&lt;br /&gt;
So we can move this column into a new supplemental table, whose primary key will be the same Author Id.&lt;br /&gt;
&lt;br /&gt;
Each record in the supplemental table will correspond to exactly one record in the main table&lt;br /&gt;
&lt;br /&gt;
which represents a One-to-one relationship.&lt;br /&gt;
&lt;br /&gt;
So there, we have learnt to set up relationships in our database.&lt;br /&gt;
|-&lt;br /&gt;
|Show Slide Number 11&lt;br /&gt;
&lt;br /&gt;
Summary:&lt;br /&gt;
&lt;br /&gt;
Database Design&lt;br /&gt;
&lt;br /&gt;
4. Turn information items into columns&lt;br /&gt;
&lt;br /&gt;
5. Specify primary keys&lt;br /&gt;
&lt;br /&gt;
6. Set up the table relationships&lt;br /&gt;
|This brings us to the end of this tutorial on the Second part of Database Design in LibreOffice Base &lt;br /&gt;
&lt;br /&gt;
To summarize, we learned the following topics on database design:&lt;br /&gt;
4. Turn information items into columns&lt;br /&gt;
&lt;br /&gt;
5. Specify primary keys&lt;br /&gt;
&lt;br /&gt;
6. Set up the table relationships&lt;br /&gt;
|-&lt;br /&gt;
|Acknowledgement Slide&lt;br /&gt;
|Spoken Tutorial Project is a part of the Talk to a Teacher project, supported by the National Mission on Education through ICT, MHRD, Government of India. This project is co-ordinated by http://spoken-tutorial.org. More information on the same is available at the following link http://spoken-tutorial.org/NMEICT-Intro. This script has been contributed by Priya Suresh, DesiCrew Solutions. signing off. Thanks for joining.&lt;br /&gt;
|-&lt;/div&gt;</summary>
		<author><name>Chandrika</name></author>	</entry>

	</feed>