1. Home
  2. Explore
  3. Computer Science
  4. Database Design Fundamentals

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Database Design Fundamentals

Transcript

Hey, what's up everybody? So for those of you who do not know me, my name is Caleb, from Caleb the video maker, too. And kill crate comm so I did a a design series A while ago is my first video series here on YouTube, about 25 videos long. And then I went on to make a 67 part video series over MySQL. And I did a couple other ones, I have over 100 databasing videos, and I wanted to, I wanted to try to tackle this, again, to try to make you better explain things better,

and also bring you to a new level of skill. So what what level of difficulty is this course going to be? It's going to be for beginners. So why do you want to use a series you most platforms, programs, applications rely on a back end database. That's how we store information in this world, everything we do is powered by a database. So it's important that you know how to properly implement database concepts designs, to know how to properly structure data. So that way, you get the best optimized database that will set you apart from the rest of the IT team or the rest of your classmates, it will give you the skills needed to get that job or whatever you want to do with it. Also, if you're just a business person, or you have your own project, and you need to learn how to build a website, or you need a database to store all the information you're using, this series will be helpful. Basically,

database design is the fundamentals of databases, you should know how to properly structure data, this series is not going to be very specific on a specimen a certain database management system. So this isn't like MySQL database design. This isn't like Oracle, this isn't SQL Server, this isn't whatever else you use, this is going to be general database design. So then you can take these skills and apply them to any of the databases that you are working on that are relational, which I mean through this series, you will you'll really understand what that means you don't get that. So the first part is going to be a lot of the concepts on the chalkboard, and I'm not going to like write tons of scripts on here. So don't worry, it's not going to be confusing to where you can't see the code on a screen. Because in reality, a lot of database design is not done on a computer

first, first, you have to think about it. And then you kind of just draw your plans, whether it be in your head or on a document. Or if you use a database design program. I use a chalkboard because I can easily draw concepts, thoughts, way the way data is connected, and all that. So a lot of these databasing videos, they're going to be on this chalkboard because that's all you really need. We're not we're not programming a database, we're

designing a database. And designing is art, you draw it, you design it. So a lot of the concepts from this video will be useful no matter what you will be using for your database. So database design. Before we talk about database design, let's first talk about a database because we can't design a database if we don't know what a database is, that doesn't even make sense. So what is a database? And that's a really good question. I'm glad you asked.

Well, I can actually tell you what a database is. And that's what this video is about. So a database is something that stores data. Alright, another vague term data. And I want you to guys, I want all of you to think about data, very broadly, don't think too specific. Think of data as anything we can store. In a database or anything we can write down. Anything that has a value can be anything. data can be the list of every single customer

of your store since 1995. Or it can be a list of every single transaction in a online shopping center. Or it can be a list of every user and their username. Or it can be a list of every single weather event. Since 1927 can be pretty much anything. It doesn't have to do with specific people data is so broad. So database is obviously broad too, because the database stores data. So yeah, just think of it like this. Here we have a database of bases where we store data. Pretty simple.

Alright, so now, that's pretty vague, and I'm not sure if that was very helpful. So now let's break it down to where we see it from a technical standpoint. Everything in this world, not everything, but almost everything is ran from a back end database. It's what stores all of our information. So for example, I like to use websites, very examples, because they're very clear. And they're very easy to understand the concept of this. When you

go to a website, and you sign up, you, you give them a username, you give them a password, and you give them an email, all of that, when you sign in the next time, it allows you to sign in, well, how did that website remember what your username, email and password was? That's because all of this information that you put in, when you registered, all of these values are given to a database. So here you can say is our database. Sorry for my craptastic

handwriting, but don't don't even worry about it. This is what's said to be the front end. This is said to be the back end. That's because we don't necessarily see what's going on back here, we can put in our email, our username and our password, and they can get stored in this database. That way, when we come back again, and we log in, we give them a username and a password, it takes that value, it checks it with the database to allow you to get into the account. That is a perfect example of a database. So the database can store that information. But it's not limited to only registration, you can use this to store all of your records of sales in a store. And also for that just goes on. Don't think of it as a limited thing, because there's so many things you can do with the database. So many things. Next question you may be asking is how does it differ from, like a spreadsheet, for example, so a spreadsheet,

basically, if you don't really know much about spreadsheets, it's basically where you have columns. And then we have rows, and we can store information about like, we can enter the values for each column. spreadsheets are good, if that's what you need for your very small company sees me. But if you want to get to any complexity, where you can, like, imagine if we wanted to select, let's say this was a spreadsheet for all of my employees, I own a huge business with 100 employees.

And I want to select every single employee who has missed less than three days and have been a an employee for at least three years, and I want to give them a $100 bonus, well, that's something if I had a spreadsheet, I'd have to manually go through that check every single value, that's not gonna work, because time is money in business. But anyways, with a database, we can run queries to get those kind of values to figure out which employees have been a member, a employee for three years and volumous, three days or less. So that's how it differs from a spreadsheet, basically, what you can do with it, if you have a spreadsheet with 10 employees, or like I'm sorry, with 10 values, and that's like you can figure out all of your information in a couple of seconds, well, then you might not need a database, that's up to you. The other thing is with with spreadsheets, it's it's a it's either

like all data or no data. Let's say I just this stored every single detail about every single employee that I had, and all I wanted was their name and their address. Well, we can't really do that easily with the spreadsheet. Unless we take all those columns and like copy and paste and all this extra garbage or find some algorithm to do things fancy Lee, if you know what you're doing, you can probably do it with a database, we can selectively choose which color. So we can say only these two columns Do we want returned, and we can ignore the rest. On top of that, we can allow different users to access different information. Back to the website example. We have Users page, and then we had a database. When here you put your username, email and password that's stored on a database. But that's not necessarily the only thing that's stored on a database. A user might only get to access

that but a database administrator might get to access when they registered, the transactions they've made on your shopping website or what they've watched what what they viewed, the comments they've made, how often they visit the web page, it's pretty much limitless to what you want to do with the database. So we can see that two different users, this person only gets to view some things at the database. This person can only can view pretty much anything with a spreadsheet.

It's kind of all or nothing. Do you have access to the spreadsheet? Yes, I do. Well, here it is. If you don't have access, well, then too bad, you don't get any of it. So that that's awesome. That's a security feature as well, because you don't want this person to get all of the hidden information that's stored within this database. So hopefully that makes things pretty darn clear. The next video, I'll kind of be talking about how data is stored in a database. Because I didn't I was going to get into that in this video, but I kind of ran out of time. But for the sake of just your understanding, if you decide not to watch the second video, which you will watch the second video for I relations, that's a term where we get the term relational database. So this series is for what's known as a relational database. That is a specific kind of database. And that's going to be most of the relation that's going

to be most of the databases that you work with. If you're working with database design. We're going to be talking about the relation, very basic. Don't freak out, but it is math, we're not going to go super in depth with math, if you want to know more about the math, I have blogs on my website about that. Caleb curry.com, forward slash blocks, advertising, not blogs, advertising house advertising, anyways, basically, a relation is just a connection

between data. So let's just think of silly example, if we have the two sets of numbers, two, four, and then the other set was six, eight, and then we kind of combined these sets. So we've kind of like crossed here, and then we cross down here. And where are these cross is our new set. So we have the combined set of six, two, and then we have the combined set of six, four, and then we have the combined set of eight, two, and then

a combined set of a four. And like you're probably wondering, like, what the heck does that have to do with database design? Well, somewhat, we kind of do the same thing with database design relation in relational database comes from this mathematical concept. But rather than combining sets of numbers, we're combining attributes of real world things. So let's apply this to the database. First, you need to know two terms. The first one is an entity. The second one is an attribute. So an entity

is anything we store data about attribute or the things that we store. So if an entity is a person, an attribute would be their name, their username, their password, their hair color, their address, their phone number, their relationship status, the person they're in a relationship with the orders that they've made, or whatever, whatever it is, it's depends on what you need to store for that specific application. So entity is what we store the data about. attribute is what we store. When we apply this to this, this connection with the the the relation, we have the attribute types and the attribute values. So let's say we have this person over here. And we'll name him Caleb, because it's an awesome name. All right. And then we will also give him a username Caleb curry with no spaces. And we'll give him a password. Pi 123. And then over here, we have the set of attributes for a table

we have name, username, and password. We can make this connection of data so the name is Caleb the username Caleb curry passwords, pi 123. That makes sense, although graphically It looks like a mess. So we store these in tables, which is exactly what we were doing with the relations. So we have up here in our columns we have we have the name and then we have the username and then the password. Don't worry if you can't read my handwriting you get it. We store this in a table. Right? So these

are the things we need to connect with this person over here. We named Caleb and I accidentally erased them, whatever. We'll just leave it at that. So that's Caleb. And we want to store this information in this table, which is a graphical way to, to illustrate how we're storing data in a database. So we take his name, Caleb, we take his username, Caleb curry, we take his password, pi 123. We kind of get this, this table concept, it almost looks like a spreadsheet that we talked

about in the last video. Although it is slightly different, and we'll be talking about that as time goes on. This guy is the entity that we're storing information about. These are the attributes that we need to store about this person, or any other person. So we enter specific values for each one of these attributes to make the relation between the attributes, and the entity. Hopefully, that makes somewhat sense. And if it doesn't, don't freak out

this all kind of I mean, this is complex thought. And you don't necessarily need to understand every single detail to design a database. So I'm just trying to explain things. And we'll get through. These are the attributes of this person, this entity, an entity is basically just anything we store data about it's something can be a person in this case, but it can also be an order, it can be a customer can be a client, it can be a employee, an

employer, whatever it is, it doesn't even have to be a person. So now, the relation idea, you kind of understand that we're just making the connection between the attributes, and the entity, the value that the entity attributes, we're entering that in the database. That's, that's kind of a weak explanation. But honestly, it doesn't really matter that much for getting into basic database design. So if you want to learn more about that, just look up relational database design, you'll figure it out. So now, we have the entity over here. And then we have the attributes. So in table terms, you probably know, rows and columns, you might not know specifically what they are. And I'm going to tell you this right here is a rough. You see that might be run out of space here. I think we're good. Yeah, we're good. So this, all of these values are a row. So a row is all of the attribute

values for a specific entity. So this row would be easier just to go like this, this row, points to that entity, that person. Pretty simple. A column are all of the values for a specific attribute type. So the attribute type is username, we can have another person Billy Joe, and his name, his password can be within you, and his name can be bill. This is another person in our table. So this is talking about a different person, we have

this person over here. pretty chill, or this row is talking about this entity. The username is a column where we have all of the attribute types username, So Caleb curry, Billy Joe, and whatever more if we put more values into the table. Okay, so it's again, a little messy, so I'm just going to clean it up a bit. Erase. So just to summarize a bit, we have very first thing we have an entity type. That's that's

the word you want to know entity type, which talks about entities I'll just I'll just tell you what an entity type is in just a sec, entity type. And then we have the attribute type. So basically, the type means it's a category. So the person was a specific entity, the case the guys named Caleb, that was an entity, it was the person then we also had the entity, Joe or Billy or whatever his name was. Those are two separate people to separate

entities, although you could tell that they were somewhat similar. They're both in the same table, they were both talking about the username, password, and so forth. So the entity type is user, a specific entity would be Caleb, or bill, or Jamie, or Jake, or whoever it is. So the entity type is basically the category of the entities that we're storing. The category is a user and all the all the entities within it should be a user. So my camera stopped

recording by itself for some reason, which is super annoying. But anyways, our entity type is the category of entities such as user, every single entity should be a user. Caleb was a user, Billy was a user, we could have Jimmy john, we could have got Katherine, we could have Caitlin, we could have Cassandra, we could have, you get the point. The attribute type is basically the categories of attributes. So we had the username, we had the name, we

had the password. These are attribute types, because we don't actually have a specific value. If like, no one's name, his name. When we actually give these specific values, they no longer become types, and they become specific examples. So this guy over here, here's our entity, we can store. So basically, here's our entity, we can store attributes about this entity, the username can be Caleb curry. The name can be Caleb. And the password can be pi 123.

So these are specific attributes about that guy. Now all these are all like complex terms, and blah, blah, blah, blah, who really cares? What really matters is can you put this into a table for people to understand who really cares if you know the terms, but I mean, I'm sure your professor care. So making that anyways. Table, the columns or the attributes, so we could have, for example, an ID, a password, a user name, and email, we could keep going address, phone number, and whatever else.

And then a row is where we give a value for every single one of these attributes, all talking about one entity. So like this guy, this guy right here? Well, his ID, for example, 72, his username is Caleb curry, his email is cool, guy@hotmail.com blah, blah, blah, blah, blah, all of this row talks about this guy. So basically, just think attributes are columns. entities are individual rows. Sweet, then this whole thing

right here. This is the table, and that is the entity type. So the entity type would be user because every single row within this table should be a user. Oh, another thing I would like to mention real quick, another name in mathematics for a row is a tupple, or tuple. I think it's terrible. I don't really know. But that is another term you'll hear. So yeah, tupple is a row. Thank you. See ya, sorry for like yelling and getting all intense, but fun. Alright.

This will be about database management systems. And because this series is over relational database design, it will be specifically relational database management systems. And we'll talk about the difference. So first, let's just talk about in general, what is a database management system. So this is often shortened to B dB, and S for database management system. And relational database management system is the same thing except it starts with an R. So the our DBMS, so I'm just gonna write that because it's easier. Alright so where we left off in the last video, we learned? Well, actually, like both of the videos, we learned that a database can be used to store a ton of information. So we have this database, just think of it like a barrel with a ton of information just piled in there. So like usernames, and like passwords and junk, and transactions. And all this stuff is listed

in here. And as you saw on the last video, it looked very similar to a spreadsheet. So what makes it different, we have all this data. Now what do we do? What do we do? Just look at it? No, don't be knew, obviously we do cool things with it. Obviously, I don't even know what that was about. So what we can do is we can run what's known as a query. So a query, just sort of like searching our data, doing something with it, and giving

us cool results. So a database management system, uses our data in manages it, allowing us to view it in a human friendly way, and do cool things such as search for values, change the appearance of data, changed the way data is stored, and so forth. So for example, we have 6 billion users, okay, just for just for an example. And we want to delete anyone who hasn't been active in a year. Well, without a database management system, all we have

is a bunch of data. And we'd still have to go manually do all that and delete all that. So the database management system, is what allows us to easily run a query, alright, select everyone who hasn't been online in a year. And then we can delete everyone who basically, basically just delete everyone who hasn't been x active in a year. Basically, a relational database management system is just a sub category of a database management system, a specific kind that is designed to work with relational databases. So yeah, not much of a difference there. So just some of the things that these database management systems can do. The first one is obviously run fancy queries to give us specific results, such as give us all of the transactions that were processed before 2011, June 10. That's something fancy we can do with a database management system. It also allows us to change

the way our data is presented. That's something known as a view mechanism. So basically, if you mechanism allows us to change the surface appearance of our data. So when we store our values in our database, we might have it to where it's, we're going to store an ID, we're going to store a username, I'm just going to shorten these up to make it easy. We're going to store username, we're going to store a password, we're going to

store an email. And then we're going to store street address, state, city, so forth. But let's just say this is how it is for now. Here is the actual table structure for the user table. So here are all of our attributes for a user. Get rid of this. So it's clear? Well, with a view mechanism, we're able to get different views of this data at the surface level. So for example, if we had two people accessing this data, one, what's his name

him, Jim, and the other one? Let's name her, Jane, ie, Jamie, Jim and Jamie. Let's say Jim, he doesn't really care about the emails, because all he's working on is to find out information about usernames and passwords. So what he might do is he might create a new view of just the username and the password. Once again, I'm just shortening these, just to make things simple for illustration, I probably wouldn't put them in the database like that, unless you wanted to, but whatever. So this

is a specific view, we can select the username and the password. But the internal structure of the data has not changed. This is still how it's stored within the database. Jamie, on the other hand, she cares about the ID and the email. So she creates a new view. Just like that. So this, these are both called views. So the view mechanism allows us to create different views. This can be used for database administrators, as well as for other applications, such as when

we have a web page, we may want. We may only want users to be able to access their username, password, and email. But stuff such as the date they registered, that might be all private on the database. So then we can just create a view giving them the information that they have access to and that is a layer of security. So basically, if we have a huge database for a business, well, the database admin administrator is going to have access to it all. The president

of the company will probably have access to it all. But the people who are advertisers, they probably only need to know information about advertising, the the people who monitor comments on your website, they are not going to need access to the sales and the transactions, they're going to need access to the the table for comments. That's a security feature that a view mechanism allows us to do by giving different views. So not every single person

who uses the database has the privilege of creating a new view, just because you can access the database does not mean you can do things such as update data, change the way it's structured, and so forth, that is probably something only the administrator or the owner of the business is going to be able to do. That means we can allow users on websites, they can only ask, they can only access their specific username and password,

they can't access everybody's username and password only theirs. But if this guy, Jim, who is hired at the company, he can access the username and password of every single user. That's a security difference difference between the two people, not allowing the user of the website to get too much information. And at the same time, not limiting Jim too few too little information. So that is a really good security feature. So what else

a relational database management system allows us to do transactions, which we'll be talking about as the time comes, basically a transaction is what it sounds like, it's when we do something with the data that for the technical terms, basically, it is either complete all the way or it doesn't work at all, if we have a multiple step thing, such as transferring money to an account, deducting that much money from the other person's account, so forth, updating the data boom saved. If at any time the power goes out, and the server crashes and it doesn't complete, well, then the transaction is canceled, nothing is saved. That's something you can do with a relational database management system. So that's pretty much the basics of relational database management system, just in case you're not really sure, like the terms and stuff, examples of relational database management systems or just database management systems.

MySQL is one. It allows us to build and run a database. SQL Server is basically like the Microsoft, if you like Microsoft, it's run on the server, and then you access it. So you have Microsoft server, we have Oracle database we have, I don't even know how to pronounce that I post gray SQL or something, and so forth, the list goes on. But basically all of the big terms that you hear in databasing, they're referring to the relational database

management system, or the database management system, if it's not relational database, don't really don't really think of the database and the relational database as two separate things. They are what they're used as one. But if you do want to be like conceptual, well things, we have the database, which stores the information, and then the relational database management system, which allows us to manipulate that data. When we have something such as

MySQL. We don't really have a difference between these two. And everything's just kind of like, okay, we use MySQL to create the data. It's stored. My SQL is kind of like all we do the actual files, they're stored on hard drives on a server or your home computer wherever you're running your database from. And the relational database management takes the data on the hard drive and puts that into presentable tables for people to like the administrator

to view because if we have like a hard drive disk, let's just say this is a hard drive disk. And some of the data is going to be stored like right here. Other parts of data that's going to be stored like right here, and some right here. Well, if this is a table the relational database management system is going Want to be able to take that and put that in the appropriate location to make it presentable, so don't really think of it

like, Oh, we have a database, and then a relational database management system, it's kind of think of them as one and all in themselves. So with stuff like MySQL. The other thing, finally, I know, I'm kind of running long on this video. The other thing a relational database management system is going to do is it's going to create consistency. In bigger piece of chalk here, consistently, it's going to make consistency behind for the front end. So on a website,

we could have someone put their full name in one box, and that can be stored on a database as two separate columns. first name last name. Well, let's say if we updated this, and we decided to make it one column for some reason, which I don't recommend, well, the front end didn't change, because the only thing that changed is the back end. With a database, we can have consistency on our front end to make our users happy, never having to worry

about things changing. On the back end, the things can change. For example, the way we store dates or our time zones or our character sets, well, that's generally, that's not going to affect the front end, unless the data on here is directly affects the front end. For example, if this is a username column, and we delete the username column, well, that's going to cause issues, because it's not a column on the database. But basically, when

we have a database, the front end is generally consistent, as well as we have server side scripting languages, such as PHP, or whatever else. Well, that is going to hide our database and even even step farther. So basically, rather than saying, oh, there's no username column, it'll say something like error, try again, later, something very vague, so people don't understand like, Oh, crap, I can pack this guy because I know his database structure, I can figure out how to mess up his website or his business or whatever. So yeah, that was a server side scripting language. I'm not gonna write that out, because it's huge. Yeah, that is the basics of relational database management system. Hopefully, that was helpful. In this video, we'll be talking about SQL. So s q, l. Alright, so what is SQL? SQL is a programming language used to communicate to a database. Basically, we speak English databases

do not so SQL is kind of like the mediator between computer database and human English, think of it like that. It's almost English, it's very simple. And in this series, we're not actually going to be programming any databases, although we will be talking about general SQL concepts. So it's important that you know about SQL. So SQL is not like a specific relational database management system. programming language, it is a general language used for every single

relational database management system. From vendor to vendor, such as MySQL to SQL server or something else, it might vary a little bit, but the general concepts of SQL stay the same. So this is this is going to be a general concept that you should know. So SQL first is used to define the database structure. And then it manipulates the data within. So basically, we can kind of think of SQL as two categories here. One, it defines the structure and then to manipulates by that it means we insert

data, and then we can search it or delete it or update it. These are the two subcategories of SQL. We actually for some reason, name these their own languages. So this is data Definition Language for DDL and this is data manipulation language, or DML. Some people may say there's more categories, but I mean this is pretty much the domain to so think of it like this. I'm just going to erase this here. Now that we have this. We have DDL

DML when we have like a table, for example, I'm just gonna write this down here. And we have the columns. So we have like ID user name, password. Well, that's data Definition Language. data manipulation language is what we would use to insert a new value, such as the ID of 72, the username of Caleb curry, the password of pi 123. That's data manipulation, language. So when you think of a table, and if, obviously, if you have a big database,

you'd have multiple tables. Well, all of this structure and the connection between tables, that's all data Definition Language. So it gets all of the main structure of the database. And then the, the data within the database is data manipulation language. So those are the two main categories. Just I just want to talk about some of the features of both of these languages. So basically, when we define tables, we have a create statement. So basically, all SQL I write in all capital

letters. That's just a pattern that I've chosen. So create is an example of an SQL command used to create tables. And we can create a database this way. That is data Definition Language, because we're defining the structure of our database, a command such as update, or, yeah, I guess, update if we're updating the actual values within columns. Well, this is manipulation. language, because we're not changing the structure, the columns stays

the same, just a specific attribute of an entity changes. we're updating Caleb Curry's username to Caleb curry 123. Well, that's a data manipulation language. Another thing that SQL can do is what's known as a join. And joins are very important, very important with a relational database management system. Because with a relational database management system, we break things up into separate tables, for simplicity sake, for one, sorry, I was

I added the scene there, I think I was whatever. Rather than having a spreadsheet with like tons of information, we break it off by entity. So here's a table about the user, here's the table about the orders, here's a table about the customers, then we can join those values to get a new, larger table, a new view, that looks like a huge organized table. I mean, basically, it looks, it doesn't look like we broke it up into multiple tables. So if

we have a table here, and then we have a table here. And let's just say we have, this is a sale table. And this is a user table. Within the sale table, we have a sale ID, we have a user ID the person who bought the stuff. And then we have the objects that they bought. And I mean, this is this this silly example just for you to understand the concept of a join. And then within the users table, we have the the name, the user ID, and so forth,

we can do a join here, we could take the objects that they bought, the person the objects that the person bought, as well as the name of the person who bought it, connected by the user ID, which will we'll talk about this more, then we can get a new view, which has the name and the items that that name, but it's all talking about the same entity, this user. So a naming convention is just a pattern that people do or that you do to keep things

consistent. So not only will this naming convention help keep my database consistent across different tables and columns. But this naming convention is not only mine, other people use this naming convention. That means when I go to a different person to review my database, they already understand what's going on. Now, obviously, there's multiple different naming conventions, there's not one way to do everything, and it's not required. This is just how I decided

to do it. And this is because most people who use my SQL, which is what I learned first use this, but for different relational database management systems, you may have different systems of naming things. So I'm just going to get Explain what I'm going to do. Anytime I write SQL, I put it in all capital letters. So select is an example. Fortunately, we're not going to be doing much SQL. So I'm not going to have to write in all capitals on

a chalkboard because it's, it's quite complicated. But when we're talking about anything I named myself, I use all lowercase letters, I just use all lowercase letters, because I just think it makes it more simple. So when we have a table, such as a user table, I don't capitalize the EU. And then when I have an ID, I just put user ID or just ID whatever, but I don't capitalize, Id I just keep it lowercase. And for spaces,

I just use an underscore, so I don't use any spaces. So basically, that's my naming convention that I use, and yours will vary. And we haven't really got to this yet. So you might not understand this. But if I have a foreign key, basically, if I have a copy a connection over here, to where we have the same column over here, I just make sure their name both the same thing. So I know what they're talking about. So yeah, I, some people will do things such as put like user table, or they capitalized certain words. And if you want to look at other naming conventions for your specific relational database management system, go right ahead. In fact, I'd encourage it. But just so you understand what I'm doing here, I will be doing another thing, when we're talking about stuff in the real world. Sometimes I don't necessarily use that naming convention. Because

if I'm writing everything I need to store about a user, well, I might just put, we need to store the user's address, I'm not going to put the underscore users underscore address, I might just put the user's address with space in English. And then when I convert when I start making this into a database, structure, schema, whatever you want to call it, then I'm going to convert that to just address lowercase. We're going to be talking about Okay, what is database design? And when we talk about what's a database, we never really talked about database design. Why do we have to design a database? What What's so special about it, it needs to design it's not like we're building a house or something? Well, in a way, it's it's kind of like that it's we're building schematics to build the best database. How do you measure whether a database is good or bad? Well, it has to do with data

integrity, which we'll talk about that in more depth in an upcoming video. So data integrity is basically where all of your data is correct, it's up to date, there's no disconnected data. For example, if we have two tables. And for some reason, these tables are connected in some way. Well, if if for some reason this link breaks, well, then when this table updates, this table gets left behind, and then the data becomes incorrect. That's

a data integrity problem, because the data is not managed properly. So with a good designed database, we prevent data integrity issues. So all of our data is up to date. We don't have, we don't have repeating data, we don't have old data that should not be in there. Which, if for example, if you have a database, you can store lots of information from like long ago, and that's fine. But you don't want data that has recently changed, and it hasn't changed in the update. So you want the database to always be up to date. Unless for some reason you're storing like an archives, let's say you have a store, and you want to store an archive of every single order you've ever made or sold or whatever, well, then you can store all that in a database. And that doesn't really need updated because it's an archive. But if you have, if you have a customer in your database, and the address is out of date

and doesn't update, well then you have a problem. Another example is if the person up has four so if your database is designed badly and you have repeating data, well then one example of the data can update and the other ones left behind. So now you have like two addresses for one person, which should just be one address. That's another example of a data integrity problem. So we'll be getting into like specific cases of data integrity problems as we go on.

But when we talk about data design, database design has Whole, people usually break it up into three sections, two or three, it just kind of depends on, like, what people mean it, it varies from person to person. So okay, first, we have the conceptual. And then we have the logical. And then we have the physical. Alright, these are all known as schemas of schemas, whatever you however you want to pronounce it, but that's

this. Alright, so we have the conceptual schema, the logical schema and the physical schema. A schema or us just think of a schematic, like when you're building something, it just tells you the way the data is structured. The conceptual, this up here is when we're just kind of thinking about things, how things are related. We don't think of limitations as an Oh, we're not going to be able to do that, because we only have this much availability

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent