okay welcome to the second video on database design and this one's going to be talking about how to create a data dictionary we're still going to use the ended and e-brake system for this and we're continuing on from the end of video one where we had identified the programmable field names for all four of the entities learner instructor vehicle and lesson Oh first question is what is the data dictionary where the data dictionary defines the way that the data is going to be structured the looking again at the entities we recognize field names we now need to start to think about the kind of data is going to be stored in those fields and therefore start to build our database structure to be ready to accept that kind of data you can see a standard form in front of you this is a basic form but it does allow you to keep the key information that you need to build your first database you'll notice at the top is the title data dictionary beneath that is something in square bracket saying entity or table name we had four entities so we would use the entity name here and that starts to become the table name then we've got the rows and columns to define the table we'll have a look as we go the first thing to do is identify which entity we're talking about and in this case we're going to develop the learn that entity and we're going to start quoting the learn that table I won't end up calling it learn the table but I know that's the one that this data dictionary relates to the first row of information we're going to put in is here the P in the first column is stands for primary and the P in the F is primary or Forum so this P is telling us at this row on this data dictionary is for the primary key now the name of that primary key as you identified to at the end of the last video was learner ID so we know that the primary key for this particular data dictionary table is the learner ID that's the field name I haven't included the caption because I know that the learner ID is never going to be seen by anyone it's simply going to be used by the system to uniquely identify each person in the learner table so along will be assigned a number and that number will be used by the system but never seen by a human being therefore no caption is needed I've also set this type to auto number now auto number the type and number that the system adds puts on the first values the first record will always be given the record 1 the value 1 the next record after that will automatically be given the number 2 so it's using the counting numbers but the system not the user not the human being but database management system thus it's behind all this will simply always add one to the new record that's being added to the database so that means we never ever have to worry about it the system will look after it because it's an auto number I don't need to define a field size and there's no notes because that's it that's all I'm gonna do I'm going to give it a field name and I'm going to ensure that it's the primary key and simply set it to auto number the second field is our foreign key that's the instructor ID remember this doesn't belong to the learner but it is something that learner relates to the instructor this is going to be the usual instructor so you can see that's what I put in the caption so the caption is what someone's going to see whenever they see this field they're never going to see the words instructor ID they're going to see usual instructor in relationship to this the datatype for this is something called long integer now a long integer is a type of number and we'll look at data types shortly but basically a long integer allows for a very long number it needs to be a long integer because it's going to relate to the instructor ID in the instructor table which is going to be set up the same way that I learned ideas here we'll have a look at that when we come to the look of building relationships the next row on this is the first of our non-key field that's struck first name again I've defined the field name as we did at the end that's the name I'm going to use so that I can program it but the caption is first name it's user friendly so when the user sees this field they're going to see the word first name that's going to explain exactly what they need to enter into here they never need to see the term straw first name wouldn't make any sense to them because I know this is going to be a whole load of letters and numbers in fact is always going to be all letters for people's first names I've assigned the data type text and text allows you to put anything into this at all it will be text field are very open they can be mixed numbers letters or anything else in there so the first name can be a construed of everything which is fine because I can't restrict if you want to call your child alpha 2 3 7 then you free to do so you'd be a but you can do so if you wish to UM field size I've set to 20 if you've got more than 20 characters in your first name then that's really difficult for you because you're not gonna really fit into my database and that's a really long name so I've gone for 20 characters that's 20 letters in your first name I'm going to assume there's not many people out there with that and hopefully they're not going to come to Andy's approach driving school from there I can go into all the other fields this straight forward you can see they're all text fields and this is straw last name and house number Street locality and all the lists the only changes the field size are maybe some women with the last name longer than 20 counters that is more likely than the first name because a lot last names can become quite lengthy house number 20 anyone think about house number I mean how big can these become but of course it could be a house name and some people like to choose long names so 20 characters for that and 30 for the others I may have a discussion and decide not but not to have that it might be longer or shorter but you do want to limit the file size as much as possible because this is taking space up on a hard drive and with a small dose base is no problem but with a huge database lots and lots people big insurance company this could take up lots and lots and terabytes of data I've stopped there but obviously if you remember back we had lots more field on the learner table when I stopped there because the next field that we want to have a look at actually has something slightly different it's the postcode and the post code is still Tet I've set it on characters you'll you notice using the notes column now the notes column I need to add some special features that I may want to include in there something to remind me that I need to pay attention to for example with a postcard there was actually a structure to the postcode that I could recognize it generally consists of a letter than the letter then a number sometimes there's another number then sometimes the next two numbers are there's two parts or either two numbers or one number always followed by two letters so letter letter number number number number letter letter is the longest postcode so that mask that's that's called an input mask in the notes column and that's telling me and the computer when I come to code it in that there is a structure to this the greater than symbol actually is telling the system that all the letters in this mask must be uppercase the letter L is not simply the letter L but it tells the computer that whatever someone types into that position must be a letter it cannot be a number or counter it must be a letter from A to Z so if you wanted to enter M and then B you can do because that's perfectly fine the letter L the letter L will let you put two letters in the zero says you must enter a number it must be a number and you must enter one the nine means that you could enter a number if you don't it will remain empty but if you try to enter anything else in there it will fail so we then got a space and the space is counted we see it as empty but actually the computer does have to know it's there then we've got the nine again could be a number the zero must be a number remember nine doesn't mean could be a number could be something else it means it's either a number or just don't put anything there zero means you must put something here and it must be a number a letter means you've got to put a letter in here so that's an input mask and that tells the system so I can build up a model of what the postcode looks like so any postcode is entered into my system must match that which stops anyone from entering the word dark him for postcode it reduces the give it erroneous postcodes because if you try to type in the wood duck it will accept the D and the U but the C and the K will fail because they're not numbers the next one does the same thing and this is always the one that gets people why is telephone number struck why is it a string why have I set it in text for God's sake is obviously a number because we use the word number in it you build a building databases you've actually got to start looking at what the actual data is not what the name implies it is a telephone number actually contains things that are not numbers if you look at the notes side you see the input mask has got a bracket then five zeros which means you've got to enter a number in each of those positions that's for the area code then there's a closed bracket then there's a space then there's three numbers followed by a space followed by three numbers and as those brackets and the spaces and the fact that the area code starts with zero dictates that you cannot have this as a number we won't have a look at those again but that note is the input mask just like postcode telephone numbers have a structure and just like the notes fill the postcode field I've put above the note part for telephone is the input mask we will actually use that in our database again you count the spaces and you count the brackets so there are actually 15 characters long there are the there's the two brackets there's the five zeroes there's the two spaces and then there's the two groups of three zeroes 15 characters and or not therefore we fill this part up but actually we still haven't got to the end of this particular entities fields there will a few more so the next thing I've got to remember is I'm actually remembered to tell tell the system and tell the user that this is learner table sheet one of two and I said to use I mean the developer the database the usual of the database will never see these sheets at all they will sit in the manual somewhere so I now change this to learn a table sheet one of two and that allows me to produce sheet two of to which you can now see mobile number is just the same done slight alteration of the input mask the date of birth field strug DOB I'll set it to the data type date time the field size is 11 and that's because I've defined its structure under notes as day day month month month year year year year this will allow you to enter 30 not 1966 it's up to you what you have in there you can change the structure DD / mm / YY YY whatever you want as long as it's a recognized standard structure I've taken this structure because that's the one appeared on the original document from Andy break school he had a date which is made up of two numbers the abbreviated for a form of the month and then for numbers you shouldn't decide you should use that the current system dictate how your data is going to look again remember four numbers for year three now our three letters for month two numbers for day and two spaces makes 11 characters in total we've then done the same thing with license licenses text but I have an input mask I've used the example given on Andy brake system for Nicola long notice however that I've put an A next to the letters the greater than symbol telling us that all the letters on here must be uppercase and the a says that this is either going to be a letter or a number in Nicola Long's example long is four letters and the next one was a number but I am aware that sometimes that can be a letter in fact I'm also aware that long if your surname only has three letters then actually it will be letter letter letter hey so I really should have put two more ICS so I already know my input mask is flawed but that will come out through testing so I'm quite happy to continue with it at this point the next one's a date again exactly the same as data birth but this one is have they passed their test then I have the next one which is a memo field note and all of this memo not to find a field sizes though notes about it I've just called it memo we'll have a look at what memo means in context with text it's simply allows a lot of text the next one level is text 19 characters long how do I know it's 19 because the longest word the parts of this is going to be the words disqualified retake I know from Andy break system that he had four choices those four choices are listed in notes and I will when I come to code this ensure that those four choices are embedded into the table so you can only choose from those four it will be a selection process that the person will go through but I must define as 19 because that's the longest part the next one is a yes/no field and this is the past theory part basically have you passed your theory yes or no so there's nothing else to define the field size doesn't matter there's no notes for this it's simply set to yes now they will actually give you a little tick box to put in on your form the last part is the manual automatic notice I've called it Stroh transmission but the caption is exactly as it appeared on Andy breaks form the data type is text and just like level I have choices in this case only two choices manual automatic I've set fill size to the longest length which is the word automatic so they're force nine characters long that's the data dictionary that's actually sorted for the data dictionary so they're both the sheets and I've now finished the learner table I would now go off and do the instructor and the vehicle and the lesson now the next sensor just could look at these data types there isn't quite a lot there's only five we need to think about text text is any group of counters or letters it allows you to enter up to 20 255 characters in total it's like a tweet but double the tweet or whatever it is it is basically texts filled allowed to put anything into them if you wish to you can imagine them as the prostitute of all data times you know accept anything the memo field is similar to a text field used it on the notes one but unlike text is not as restrictive where text only allows 255 characters the memo field will allow that use 65,000 or more imagine the back of a DVD case you've got the front which is the title that will let's find that text maybe but a director that's fine that's text but the blurb on the back that tells you about the DVD well that's a lot of text so you'd make it a memo field so you could enter all that text number only allows numbers either hole counting numbers fractional numbers percentiles anything that's a number and we have a bit of a look at numbers in seconds pretty obvious what date/time is it's a date or a time and yes/no offers you two choices yes/no or whatever else but it's basically allows you to select so if you know you've only got two choices yes now is what you're looking for those are the five basics that you would use on the data a data dictionary there are other ones you can define but you'll find out about those as you explore database is fun so when there's a number not a number well actually as we saw with telephone numbers they're not numbers so the one of the first criteria need to understand is is there a leading 0 if there is then remember with counting numbers if I've got 0 1 and it's a counting number I don't mention the 0 I simply say 1 and what the database will do is if you enter into a database number and you enter 0 1 it will drop the leading 0 that's the 0 that comes before the number now that's fine with a number but with a telephone number if I try to call the number oh 144 and I put and I drop the 0 tiny entered 1 4 2 4 it would fail it wouldn't work it wouldn't be recognized as a telephone number the second example is like a country code 0 0 4 4 for the UK if you allow the leading zeros to be dropped because I defines the number it would select 4 4 that's not a national international dialing code and therefore your telephone call would fail so if you've got a leading 0 it's got to be text another one is when there are non numeric characters 12 n so there's ever the risk of a letter all the spaces in 32 space 32 or whatever brackets anything that's not a number then that field cannot be a number it's going to become text the third and final one is does it make sense to perform calculations my first example states telephone number x 3 clearly that makes no sense please take my telephone number and multiply by 3 why the hell would I do that it makes no sense whatsoever same as the next one I live at house number 14 please add 3 why would you do that you wouldn't so let's not even bother getting a vault in it those are the 3 instances leading 0 non numeric character performing count not being able to perform or not bothering to perform calculations tells you that the number is not a number it's a text field just to apply that to telephone number as a telephone number we can see on there that first of all there's a leading 0 0 1 4 2 4 we can also see that there are non numeric counters 2 brackets and there's a space and last but not least as we said before it makes no sense to perform calculation on the telephone number ok finally with the input masks just momentarily just to go through them those are all the characteristics you can see that 0 the user must enter digit 9 user can can enter digit I'm not going to read all those those are freely available on the web and obviously you can pause this video at any stage and have a look at those they all have special meanings and they're all incredibly useful in fact you should get to know them and I should help I hope that's been helpful and talk to you in video number 3