BTEC Level 3 Database Exam - Part A - Walk through - Part2

MyStudentSite
3 Nov 202021:02

Summary

TLDRThe video provides a detailed tutorial on setting up tables in Microsoft Access, focusing on using appropriate data types, creating primary and foreign keys, and establishing relationships between tables. It covers essential practices like using short text for phone numbers to preserve leading zeros, creating input masks for text fields, and applying validation rules to ensure accurate data entry. The tutorial also demonstrates how to enforce referential integrity and cascade updates/deletes to maintain consistency across related tables, concluding with a walkthrough of viewing relationships and linked data entries.

Takeaways

  • ๐Ÿ”‘ The task involves creating table structures and applying appropriate data types and validations in Microsoft Access.
  • ๐Ÿ—ƒ๏ธ Primary keys will use auto numbers, and short text will be applied for fields like names and telephone numbers.
  • โ˜Ž๏ธ Telephone numbers are stored as short text to avoid issues with leading zeros being removed in number format.
  • ๐Ÿ“ Foreign keys will be stored as numbers to align with the auto number primary keys in related tables.
  • ๐Ÿ“Š Users must apply data validation and input masks to ensure proper data entry and formatting (e.g., capitalizing first letters in names).
  • ๐Ÿ“ It's essential to change field sizes and not rely on default settings, especially for fields like names and telephone numbers.
  • ๐Ÿ”— Relationships between tables are established by connecting foreign keys to primary keys, creating one-to-many relationships.
  • ๐Ÿ› ๏ธ Users should enforce referential integrity and enable cascading updates and deletes to maintain data consistency.
  • ๐Ÿ’ก Lookup tables help users avoid remembering ID numbers by providing drop-down lists for easy data entry.
  • ๐Ÿ” Presence checks and validation rules (e.g., 'Is Not Null') are used to ensure required fields are filled in, improving data accuracy.

Q & A

  • What is the primary reason for using short text instead of a number data type for telephone numbers?

    -Short text is used for telephone numbers because if a number data type is chosen, the leading zero will be omitted when inputted into the database. To preserve the format, especially for phone numbers starting with zero, short text is more appropriate.

  • Why is it important to change the field size for short text fields such as names in the database?

    -Itโ€™s important to change the field size for short text fields to ensure that they are appropriately sized for the data that will be entered. The default size might be too large or too small for specific fields like names, and setting a proper size (e.g., 25 characters) prevents wasted space or truncation.

  • What is an input mask, and how is it used in this database setup?

    -An input mask is used to control how data is entered into a field. In this setup, it is used to ensure that the first letter of names (like forename and surname) is capitalized. The mask includes a greater-than symbol (>) for capitalization followed by a capital 'L' for the first letter and a series of question marks for the remaining characters.

  • Why are auto numbers used for primary keys in tables?

    -Auto numbers are used for primary keys because they automatically generate unique values for each record, ensuring that every entry in the table has a unique identifier without manual input. This helps maintain data integrity, especially in relational databases.

  • What role does the foreign key play in relational databases, as discussed in this script?

    -A foreign key in relational databases links two tables by referencing the primary key of another table. It ensures that relationships between records in different tables can be established, such as linking customer records to ticket sales.

  • What is the purpose of the 'presence check' mentioned in the script?

    -The presence check ensures that certain fields, like first name or surname, are not left empty when inputting data. It is implemented through a validation rule ('Is Not Null'), which forces users to enter a value for required fields.

  • What is the purpose of enforcing referential integrity in the relationships between tables?

    -Enforcing referential integrity ensures that relationships between tables remain consistent. For example, it prevents deleting a record in one table that is still being referenced by a foreign key in another table. It also allows cascading updates and deletions to maintain data consistency across related tables.

  • Why is a lookup table used for fields like customer type?

    -A lookup table is used to make it easier for users to select predefined values (e.g., customer types such as 'regular' or 'guest') from a dropdown list instead of manually entering data, reducing input errors and standardizing entries.

  • What is the purpose of creating meaningful names for database tables and fields?

    -Meaningful names help make the database structure more understandable and easier to work with, especially for others who may use or maintain the database. For example, naming a table 'tbl_Customer' instead of 'Table1' clearly indicates the table's content.

  • Why is it important to set validation rules and provide validation text in the database?

    -Validation rules ensure that the data entered into a field meets specific criteria (e.g., presence checks), while validation text provides users with feedback when their input doesnโ€™t meet the required conditions. This helps prevent errors and improves data quality.

Outlines

00:00

๐Ÿง‘โ€๐Ÿ’ป Understanding Table Structures and Validations

This section introduces the task of setting up table structures and validations in a database. It discusses selecting the right data types for various elements in the table, such as auto numbers for primary keys, short text for names, and telephone numbers. The importance of matching foreign keys with primary key data types for relationship consistency is also emphasized. The process of entering the data types and validation rules in Microsoft Access is outlined, including creating and naming tables, and ensuring relationships work properly.

05:01

๐Ÿ”  Naming Conventions and Input Masks for Customer

This section explains the importance of using consistent naming conventions and input masks for fields such as telephone numbers and zip codes. It highlights best practices for ensuring data integrity and user-friendly database management.

Mindmap

Keywords

๐Ÿ’กTable Structure

A table structure refers to the organization of data within a database table, including the fields, data types, and relationships between tables. In the script, it is emphasized that designing the correct table structure, including using appropriate data types, is crucial to ensuring accurate data storage and relationships between tables.

๐Ÿ’กData Types

Data types define the kind of data that can be stored in a field of a database. Examples include 'short text' for names and 'auto number' for primary keys. In the video, data types are carefully selected for each field, such as using 'short text' for phone numbers instead of 'number' to prevent the loss of leading zeros.

๐Ÿ’กPrimary Key

A primary key is a unique identifier for each record in a table. It is used to ensure that each entry is unique and can be referenced elsewhere. In the video, the primary key is often set as an 'auto number' to automatically generate a unique identifier, such as 'customer_id' or 'ticket_type_id'.

๐Ÿ’กForeign Key

A foreign key is a field in a table that links to the primary key of another table, establishing a relationship between the two tables. The script discusses the importance of using foreign keys, such as 'customer_type_id', to link tables and create relationships between customer data and ticket sales.

๐Ÿ’กInput Mask

An input mask is a rule applied to a field to control how data is entered and displayed. For example, a mask can enforce the first letter of names to be capitalized. In the video, an input mask is applied to fields like 'full name' and 'surname' to ensure consistency in data entry.

๐Ÿ’กValidation Rule

A validation rule ensures that data entered into a field meets certain criteria. In the script, validation rules like 'Is Not Null' are used to ensure that critical fields such as 'first name' and 'surname' are not left empty. This helps maintain the integrity of the data.

๐Ÿ’กDesign View

Design View is a mode in database applications like Microsoft Access where users can define table structure, including field names, data types, and validation rules. The video demonstrates switching to Design View to create and customize tables, such as 'tbl_customer' and 'tbl_ticket_type'.

๐Ÿ’กAuto Number

Auto number is a data type used for fields where a unique number is automatically generated for each new record. In the script, the 'auto number' data type is used for primary keys like 'customer_id' to ensure each customer has a unique identifier automatically assigned.

๐Ÿ’กLookup Wizard

The Lookup Wizard is a feature in Microsoft Access that allows users to create a field that looks up values from another table or a list of options. In the video, the Lookup Wizard is used to create dropdowns for 'customer type' with options like 'Guest', 'New', or 'Regular', making data entry more user-friendly.

๐Ÿ’กReferential Integrity

Referential integrity ensures that relationships between tables remain consistent, preventing orphaned records or mismatched data. In the video, referential integrity is enforced when linking tables, ensuring that updates or deletions in one table automatically cascade to related tables.

Highlights

Introduction to task 2, focusing on table structures and validation.

Emphasis on using the correct data types for table elements, including primary and foreign keys.

Primary keys should use auto numbers, while short text is used for fields like names and telephone numbers.

Explanation of why short text is used for telephone numbers instead of numbers, to preserve leading zeros.

The importance of matching data types between foreign keys and primary keys to maintain relationships.

Step-by-step guide on creating a blank Access database and setting up tables with appropriate names and data types.

Using 'tbl_' as a naming convention for tables to ensure clarity and organization.

Creating an input mask for name fields to automatically capitalize the first letter.

Detailed process of adding a telephone number field with a validation rule to ensure it accepts only digits.

Explanation of creating a customer type foreign key in the customer table for future relationships.

Importance of reviewing and checking data types, field sizes, and input masks for accuracy before proceeding.

Step-by-step instructions for setting up a new table for ticket types, including cost fields with currency format.

Introduction of 'presence check' validation to ensure fields are not left blank.

Utilizing table lookups to simplify referencing values for foreign keys, such as customer types.

Establishing relationships between tables by linking primary keys and foreign keys, enforcing referential integrity.

Transcripts

play00:03

in task 2 we're going to be looking at

play00:05

the table structures and validations

play00:07

going to be required to be

play00:08

input into our tables themselves

play00:11

so as you can see we have our four

play00:13

tables within these tables we're going

play00:15

to need to make sure that we're using

play00:17

the right data types for each of the

play00:18

elements inside

play00:20

these data types will range from primary

play00:22

keys which will be using auto numbers

play00:24

they'll be also using short text for

play00:26

things like names

play00:28

and surnames we're also going to be

play00:30

using things like short text

play00:31

for our telephone numbers as a telephone

play00:34

number starts with a zero

play00:35

and if we use a number in this instance

play00:38

the zero will be emitted

play00:39

when we put the data set in when we deal

play00:42

with our foreign keys

play00:44

we need to make sure that these foreign

play00:45

keys are going to be using a number

play00:47

as when we use auto number and move into

play00:50

our relationships

play00:52

the numbers generated will need to match

play00:54

the data types

play00:55

in each of the tables so we place our

play00:58

foreign keys as numbers

play01:01

so now let's jump into the access

play01:03

database program

play01:04

and start to apply our data types

play01:06

structures

play01:07

and validation to our tables so that

play01:10

when we create relationships they work

play01:12

properly

play01:16

once we gain access to access database

play01:19

we're going to need to choose

play01:20

to create a blank database we do that by

play01:23

simply selecting the blank database

play01:25

option

play01:26

access is very good because this forces

play01:28

us to create an

play01:30

appropriate name to save our database

play01:32

with

play01:33

straight from the outset so make it that

play01:36

it's meaningful

play01:37

and in this instance we're going to use

play01:38

part a

play01:41

and click on the create or press enter

play01:45

what happens is you'll be displayed with

play01:47

this data area

play01:49

that we want to change by changing the

play01:51

view

play01:52

and we're going to change it to design

play01:53

view and again this forces us to create

play01:56

and save our tables as we go along we

play01:59

need to make sure that we're using an

play02:00

appropriate naming convention

play02:02

and in this instance we're going to use

play02:04

tbl to represent table

play02:06

then underscore and customer

play02:09

click ok and this puts us into the

play02:11

design view stage

play02:13

here you can see that we all have a

play02:16

primary key

play02:17

and that it's automatically set as an

play02:19

auto number

play02:20

but this primary key doesn't really have

play02:22

much of a meaning so we're going to put

play02:23

some information in front of it

play02:24

and we're going to put customer and use

play02:26

it underscore rather than a space

play02:30

notice the little key on the side shows

play02:32

that it's primary key

play02:34

and on the description element it's

play02:35

always good practice to make sure that

play02:37

we put something in here to make sure

play02:39

that

play02:39

if anybody else was to pick up the

play02:41

database they know what this is for

play02:43

so as you can see this is a unique

play02:45

identifier

play02:46

and that is with the information that

play02:48

we're going to be putting inside of our

play02:49

optional area for the description

play02:52

you can also put in here some

play02:54

information about the

play02:56

type of data that you're going to be

play02:57

putting in here or the data type

play03:00

so as you can see we put that that's

play03:02

going to be auto number

play03:04

and if we do anything like an input mask

play03:06

or a

play03:07

piece of data validation we can also put

play03:09

that information in there

play03:10

so that anybody looking at the table

play03:12

from a snapshot point of view

play03:14

they'll be able to see what we're going

play03:15

to do the next one we're going to put in

play03:17

here is going to be the full name

play03:18

and we're going to choose a data type

play03:20

that's appropriate for name

play03:22

and this is going to be our short text

play03:24

option

play03:26

as you can see there are a variety of

play03:27

choices we can make here

play03:29

but short text is the most appropriate

play03:32

down at the bottom we have our

play03:33

properties

play03:34

and in the properties for this field

play03:36

name we can choose to change the field

play03:38

size

play03:39

do not leave this as the default as this

play03:42

is very important that we need to change

play03:44

these to 25

play03:45

or anything most appropriate for the

play03:47

field information that's going to be put

play03:49

in there

play03:59

so we need to move on to the next part

play04:01

and

play04:02

we're going to make making an input mask

play04:04

for this

play04:05

instance of our field name and

play04:09

we're going to be putting some

play04:10

information in to make sure that any

play04:12

entry

play04:13

will capitalize the first letter so what

play04:15

we do is do a greater than symbol

play04:17

a capital l to represent a capital

play04:19

letter

play04:20

then a less than symbol and then a

play04:22

series of question marks

play04:25

once we've done that what we're going to

play04:26

do is we're going to copy that and we're

play04:28

going to put it in the description

play04:30

just so that it's clear to anybody as we

play04:32

said before

play04:33

that there is an input mask attached to

play04:36

this

play04:36

entry or field name so

play04:40

because we have 25 characters in our

play04:43

field size

play04:44

it'll allow us to make sure that the

play04:46

first one of any entry will be

play04:49

capital letter now we're going to move

play04:52

on to

play04:53

the next entry within our field name

play04:55

we're going to use surname

play04:57

we're going to also choose this to be

play04:59

short text and we're going to

play05:01

do the same again as we did with our

play05:03

full name and make sure that there's an

play05:04

input mask in there to

play05:06

capitalize the first letter for us

play05:10

and again good practice just put some

play05:13

information inside of the description

play05:15

so it's clear to users what's going on

play05:18

and as i didn't put it in the aboriginal

play05:21

four name one i'm going to put in there

play05:23

the

play05:24

input mask as well and that's going to

play05:25

be greater than l

play05:27

capital l less than and then a series of

play05:30

question marks after

play05:44

and just for good practice i will update

play05:46

that one now so there's got four name

play05:48

and it's got the description to the

play05:49

input master that's there as well

play05:53

then as you can see on the left hand

play05:54

side the last one that we need to put in

play05:56

is a telephone number

play05:57

now this is very much a tripping block

play06:00

for most students when it comes to

play06:02

doing the exam because they

play06:04

instinctively want to choose number

play06:07

because it is a phone number but

play06:10

unfortunately access doesn't deal with

play06:12

numbers in the same way that we'd expect

play06:14

it to

play06:15

because it'll emit the zero at the

play06:16

beginning so what we need to do is

play06:18

choose a short text option

play06:21

and what we can also do is we can define

play06:24

the field length to the standard length

play06:26

of the phone number

play06:28

and this is around 11 characters

play06:31

without any area code or

play06:35

country codes added

play06:38

so what we're going to do is just again

play06:40

put some information in the description

play06:42

just to make sure that it's clear that

play06:44

this is going to be short text because

play06:45

the 0 would be removed

play06:47

and again this will allow us when it

play06:49

comes to our exams

play06:50

to show that we understand why we're

play06:52

doing something and the reasons behind

play06:55

what we've done

play06:56

but what we can also do is if we go down

play06:59

to the properties

play07:00

we're going to change the field size as

play07:02

mentioned to the standard size of a

play07:04

phone number which is approximately

play07:06

or is 11 characters or digits long

play07:10

and we can also make sure that we've got

play07:12

some form of input mask

play07:14

attached to that as well the input mask

play07:17

can allow only numbers to be entered in

play07:20

to our short text field so in order for

play07:23

us to do that

play07:24

we can do the following

play07:34

so we're going to add a validation rule

play07:35

to this field name and we're going to go

play07:37

into the validation rule section

play07:40

in order for so we're going to add a

play07:41

validation rule to this

play07:54

exclamation mark zero

play07:58

hyphen nine close the square bracket

play08:02

and then star again

play08:13

once we set everything how we want it to

play08:15

be in the table it's good practice just

play08:16

to go back over the field names and

play08:18

check

play08:19

that all our data types are correct the

play08:21

field sizes are also correct

play08:23

and any input masks are also correctly

play08:26

input

play08:27

this is an opportunity for us to make

play08:29

sure that there's going to be no issues

play08:30

coming into the relationships later on

play08:33

or even if when we come to put the data

play08:35

into the database

play08:38

and finally we're going to add the

play08:40

customer underscore type

play08:42

underscore id as a foreign key into our

play08:46

customer table so that we can see what

play08:49

customer types

play08:50

are inside of our customers

play08:53

lastly once we've done all that we need

play08:55

to click on save

play08:56

and close

play09:04

next we're going to create another table

play09:06

and this time we click on the design

play09:08

view

play09:09

we're going to make sure that this table

play09:11

is called

play09:12

tbl underscore

play09:18

ticket underscore type

play09:23

again as we did with the customer table

play09:25

we're going to jump into our data view

play09:27

and we're going to change the id to be

play09:29

something meaningful so we're going to

play09:31

put in ticket

play09:32

underscore type

play09:36

underscore id we're going to leave the

play09:39

data type to be an auto number

play09:42

and we're going to put some information

play09:43

inside the description area just to make

play09:44

sure that it's clear that we know what's

play09:46

happening

play09:47

and we're going to put as primary key

play09:49

next we need to look at our ticket

play09:51

underscore type

play09:56

and this is going to be a short text

play10:00

next we move on to the ticket

play10:03

underscore cost

play10:10

this time around we need to change the

play10:12

data type

play10:13

to be currency

play10:20

and if we move down to the bottom part

play10:21

of the properties you'll see that the

play10:23

format is that this is in

play10:25

currency here we can choose to change it

play10:28

if we was using european information we

play10:31

could change the format to be

play10:33

in a euro but obviously we're dealing

play10:36

with

play10:37

uk so we're going to check leave it as

play10:39

pounds

play10:43

and we're going to go back up to our

play10:44

description section and just add

play10:46

a little bit more information in

play10:52

so as you can see here i've added some

play10:54

information relating to the ticket types

play10:56

we've got our friday saturday

play11:00

and our camping

play11:08

now we're going to move on to the next

play11:09

table which is tbl

play11:11

underscore ticket

play11:14

sales

play11:18

this table is going to be dealing with a

play11:21

primary key again

play11:22

but this time around we're going to put

play11:24

ticket

play11:26

underscore number

play11:29

and instead of the data type being an

play11:32

auto number we're going to change this

play11:33

we're going to change this to number

play11:36

because auto number starts from 0 or

play11:39

from 1

play11:40

the next number will be 2 3. as you can

play11:43

see in our example

play11:45

inside of our exam the number starts at

play11:48

1000 and then goes 1001

play11:52

2 3 and so on

play11:55

so what we're going to do is we're going

play11:56

to leave it as a primary key but we're

play11:58

going to define the number ourselves

play12:00

so we're going to allow the user to

play12:02

input the ticket number

play12:04

then we're going to place in our first

play12:06

of three

play12:07

foreign keys the next foreign key we're

play12:10

going to place in

play12:11

is customer underscore id this will

play12:14

allow us to relate

play12:15

the ticket number to an appropriate

play12:18

customer

play12:20

and then finally we're going to select

play12:22

ticket

play12:23

underscore type underscore id

play12:27

again choosing the id

play12:30

to be a number and this will allow us to

play12:33

work out what type of

play12:34

ticket that the person has bought

play12:36

whether it's a camping

play12:38

or a friday or saturday ticket

play12:44

now that we have all of our tables we

play12:45

want to now add something that's known

play12:47

as a presence check

play12:48

a presence check will make sure that

play12:50

there is something entered inside of our

play12:52

fields

play12:53

and to do that we can go inside of the

play12:56

validation rule option

play12:58

go to the very end of the row and you'll

play13:00

find there

play13:01

is a button with three dots on it if you

play13:03

click on that that will open up the

play13:04

expression builder

play13:05

inside the expression builder we can

play13:07

start to formulate and build our

play13:09

rules so that we can make sure that

play13:11

something is true

play13:13

so what we can do is we can set a

play13:15

validation rule of is

play13:16

not null this will make sure that

play13:20

this value cannot be omitted or missed

play13:24

and that a value has to be entered

play13:28

additional to a validation rule it's

play13:29

always good practice to add some

play13:30

validation text

play13:32

this text will allow the user to see

play13:35

that there is a

play13:36

required element inside of the actual

play13:38

field and the message is asking them to

play13:40

please enter

play13:41

a customer first name

play13:57

as we did with the full name we're going

play13:59

to follow through and use this on the

play14:00

surname

play14:01

so we're gonna open our expression

play14:03

builder and type in

play14:05

is not null and then click ok

play14:09

and as before we're going to make sure

play14:10

that we've got some validation text that

play14:12

asks the person to please enter in

play14:15

a surname

play14:36

at this stage we're going to be looking

play14:37

at how we can make it easy for our users

play14:40

to use the system

play14:42

as you can see we're looking at the

play14:43

customer type id here

play14:45

and we don't want to remember an id

play14:47

number to

play14:48

reference to a value so what we can do

play14:51

is we can use what's known as a

play14:53

table lookup in order to do that select

play14:56

the lookup option

play14:58

and then inside here we can choose an

play15:00

option to list

play15:01

box choose our row source to be a table

play15:04

or query

play15:06

we're going to select the table that we

play15:07

want and then we're going to bound

play15:10

the column to which the value is going

play15:12

to be coming from so that's going to be

play15:13

the first column

play15:15

inside of the customer type table

play15:18

and we're going to show two columns in

play15:20

the column count

play15:22

so as you can see from the example here

play15:24

we're just entering in some ticket

play15:26

number details

play15:27

and we're assigning that ticket number

play15:29

to a customer

play15:30

customer number one and then you'll see

play15:33

now that we've added

play15:34

the lookup table that we can actually

play15:36

choose from an option

play15:38

of friday saturday and camping

play15:44

we're now going to create another table

play15:46

this time it's going to be our

play15:48

customer type table so go ahead and

play15:50

create a new table

play15:52

and then when you go inside we're going

play15:53

to name this one tbl

play15:55

underscore customer underscore type

play16:00

in here we're going to give our first

play16:03

field the

play16:04

primary key and we're going to make this

play16:06

the customer underscore

play16:09

type underscore id i'm going to leave

play16:12

this as an auto number

play16:13

and we're going to put some information

play16:14

inside of the description just to remind

play16:16

ourselves that this is actually

play16:18

the primary key

play16:28

then we're going to move on and make

play16:30

something that's very new to us i'm

play16:31

going to use what's known as a value

play16:32

lookup

play16:34

so in order for us to create a value

play16:36

lookup we're going to create a new field

play16:38

and we're going to call it customer type

play16:42

and this time inside of our data or the

play16:45

data type area

play16:47

we're going to choose from the very

play16:48

bottom of the options that we have

play16:50

available

play16:51

the lookup wizard

play16:54

in here we want to type in the values

play16:57

that i want

play16:58

this will open up a dialog box which

play17:00

will allow us to enter in the

play17:01

information we want

play17:03

and how relevant it will be

play17:07

so in here we're going to give the

play17:08

option of guest of organizer

play17:13

we're going to make a value for new and

play17:16

we're going to put the final one which

play17:18

is regular

play17:22

we can add more columns if we want to

play17:24

but this would be sufficient for us

play17:26

right now

play17:30

what should happen once we've selected

play17:32

that

play17:37

and we're going to add some information

play17:38

into the description area

play17:40

this is going to be just information

play17:42

that is drop down box

play17:44

of the options available

play17:55

i'm going to enter the table and we're

play17:56

going to look and we're going to apply

play17:58

our

play17:58

customer id types so as you can see from

play18:00

the drop down box we have regular

play18:03

we're going to do one for new and we're

play18:04

going to do one for the guest organizer

play18:07

we're going to save that

play18:14

relationships within relational

play18:17

databases

play18:18

are key to their success relationships

play18:21

work by having a foreign key and a

play18:23

primary key

play18:24

link two three or even more tables

play18:27

together

play18:28

so that data can be referenced between

play18:31

them

play18:32

in our example of this exam paper we're

play18:34

going to be pulling in

play18:35

all of the four tables that we have

play18:38

choose the relationships option inside

play18:41

of access

play18:42

and then using the dialog box open all

play18:45

of

play18:46

the tables so that they display as so

play18:50

if you have them open you're going to

play18:51

need to close them so that we can then

play18:54

see

play18:54

in our relationships area all of the

play18:57

tables

play18:59

here you'll notice that you can see the

play19:01

primary keys inside of each of the table

play19:03

in order for relationships to be

play19:05

established between the tables

play19:07

simply drag the primary key into the

play19:10

location where the foreign key is

play19:12

located

play19:13

you'll notice that the relationship type

play19:15

is a one to many

play19:16

we need to enforce the referential

play19:18

integrity and ensure the cascade update

play19:20

and cascade delete options are selected

play19:28

i'm going to move over to ticket type

play19:30

and i'm going to drag the ticket type

play19:32

into

play19:33

the ticket sales id make sure there's a

play19:35

one-to-many relationship there

play19:39

and finally we're going to move the

play19:40

customer id out of the customer table

play19:42

and place this inside the ticket cells

play19:45

we're going to enforce the referential

play19:46

integrity cascade the update

play19:48

and cascade delete and click create

play19:53

now we should have our relationships

play19:54

between our tables established

play19:56

and hopefully that will mean that the

play19:58

data will cascade between the two or

play20:01

three or four tables

play20:03

so that we know that we've got the

play20:04

correct information present

play20:07

so what i'm going to do now is just open

play20:08

up the tables just to see if the

play20:10

relationships are established between

play20:12

them

play20:12

and i can notice as soon as i've opened

play20:14

some of the tables that there are little

play20:16

plus signs next to

play20:17

the primary key if we click on these

play20:19

they'll expand open and they'll see the

play20:21

links between

play20:23

the data so we can see that mildred

play20:25

mitchell our customer id number one has

play20:27

bought ticket number

play20:29

1000 and 1001 and we can see that

play20:32

eric ferguson has bought ticket number

play20:34

1004

play20:35

1005 but this works for all of the

play20:38

tables so we can see

play20:39

how many people or what tickets were

play20:42

linked to

play20:43

new customers or regular customers or

play20:45

organizing customers

play20:47

or guest organizers and we can see what

play20:49

tickets are

play20:50

for what days as well so you can see

play20:53

that there's an allocation there for

play20:55

camping tickets saturday tickets and

play20:58

friday tickets

Rate This
โ˜…
โ˜…
โ˜…
โ˜…
โ˜…

5.0 / 5 (0 votes)

Related Tags
Database DesignMicrosoft AccessData ValidationTable RelationshipsPrimary KeysForeign KeysInput MasksData StructuringAuto NumberingUser-Friendly Interface