[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:01.05,0:00:02.89,Default,,0000,0000,0000,,In this video, we'll learn about the Relational Model. Dialogue: 0,0:00:03.85,0:00:05.34,Default,,0000,0000,0000,,The Relational Model is more than Dialogue: 0,0:00:05.57,0:00:07.49,Default,,0000,0000,0000,,35 years old, and it's Dialogue: 0,0:00:07.69,0:00:09.37,Default,,0000,0000,0000,,really the foundation of database management systems. Dialogue: 0,0:00:09.92,0:00:12.01,Default,,0000,0000,0000,,It's spawned a many billion dollar industry. Dialogue: 0,0:00:13.61,0:00:15.42,Default,,0000,0000,0000,,The relational model underlies all Dialogue: 0,0:00:15.70,0:00:17.80,Default,,0000,0000,0000,,commercial database systems at this point in time. Dialogue: 0,0:00:18.55,0:00:21.36,Default,,0000,0000,0000,,It's actually an extremely simple model and that's one of its benefits. Dialogue: 0,0:00:22.41,0:00:23.74,Default,,0000,0000,0000,,Furthermore, it can be queried. Dialogue: 0,0:00:24.50,0:00:25.32,Default,,0000,0000,0000,,By that I mean we can ask Dialogue: 0,0:00:25.56,0:00:26.92,Default,,0000,0000,0000,,questions of databases in the Dialogue: 0,0:00:26.98,0:00:28.86,Default,,0000,0000,0000,,model using High Level Languages. Dialogue: 0,0:00:29.99,0:00:31.47,Default,,0000,0000,0000,,High Level Languages are simple, yet Dialogue: 0,0:00:31.84,0:00:34.28,Default,,0000,0000,0000,,extremely expressive for asking questions over the database. Dialogue: 0,0:00:35.38,0:00:36.90,Default,,0000,0000,0000,,And finally, very importantly there Dialogue: 0,0:00:37.45,0:00:39.80,Default,,0000,0000,0000,,are extremely efficient implementations of Dialogue: 0,0:00:39.97,0:00:41.70,Default,,0000,0000,0000,,the relational model and of Dialogue: 0,0:00:41.89,0:00:43.29,Default,,0000,0000,0000,,the query languages on that model. Dialogue: 0,0:00:43.76,0:00:45.00,Default,,0000,0000,0000,,So let's move ahead and Dialogue: 0,0:00:45.13,0:00:47.44,Default,,0000,0000,0000,,understand the basic constructs in the relational model. Dialogue: 0,0:00:48.66,0:00:51.44,Default,,0000,0000,0000,,So, the primary construct is in fact, the relation. Dialogue: 0,0:00:51.98,0:00:53.39,Default,,0000,0000,0000,,A database consists of a Dialogue: 0,0:00:53.43,0:00:54.93,Default,,0000,0000,0000,,set of relations or sometimes Dialogue: 0,0:00:55.39,0:00:57.53,Default,,0000,0000,0000,,referred to as "tables", each of which has a name. Dialogue: 0,0:00:58.40,0:01:00.62,Default,,0000,0000,0000,,So, we're gonna use two relations in our example. Dialogue: 0,0:01:01.99,0:01:03.13,Default,,0000,0000,0000,,Our example is gonna be a fictitious database Dialogue: 0,0:01:03.58,0:01:05.10,Default,,0000,0000,0000,,about students applying to colleges. Dialogue: 0,0:01:05.48,0:01:07.47,Default,,0000,0000,0000,,For now we're just gonna look at the students and colleges themselves. Dialogue: 0,0:01:08.50,0:01:09.46,Default,,0000,0000,0000,,So we're gonna have two tables, Dialogue: 0,0:01:09.97,0:01:11.18,Default,,0000,0000,0000,,and let's call those tables Dialogue: 0,0:01:11.85,0:01:14.23,Default,,0000,0000,0000,,the Student table and the College table. Dialogue: 0,0:01:15.34,0:01:16.42,Default,,0000,0000,0000,,Now, as an aside, there's Dialogue: 0,0:01:16.62,0:01:17.83,Default,,0000,0000,0000,,a healthy debate in the Dialogue: 0,0:01:18.23,0:01:19.82,Default,,0000,0000,0000,,database world about whether tables Dialogue: 0,0:01:20.31,0:01:22.62,Default,,0000,0000,0000,,relations ought to be named using the singular or the plural. Dialogue: 0,0:01:23.31,0:01:24.98,Default,,0000,0000,0000,,I personally don't have a stake in that debate. Dialogue: 0,0:01:25.20,0:01:26.05,Default,,0000,0000,0000,,I'm going to use the singular. Dialogue: 0,0:01:27.98,0:01:29.75,Default,,0000,0000,0000,,Next, we have the concept of attributes. Dialogue: 0,0:01:30.34,0:01:31.79,Default,,0000,0000,0000,,So every relation and relational Dialogue: 0,0:01:32.27,0:01:33.87,Default,,0000,0000,0000,,database has a predefined set Dialogue: 0,0:01:34.39,0:01:37.11,Default,,0000,0000,0000,,of columns or attributes each of which has a name. Dialogue: 0,0:01:37.76,0:01:39.11,Default,,0000,0000,0000,,So, for our student table, Dialogue: 0,0:01:39.79,0:01:40.72,Default,,0000,0000,0000,,let's say that each student Dialogue: 0,0:01:41.12,0:01:42.01,Default,,0000,0000,0000,,is gonna have an ID, a Dialogue: 0,0:01:42.84,0:01:46.31,Default,,0000,0000,0000,,name, a GPA and a photo. Dialogue: 0,0:01:46.99,0:01:48.12,Default,,0000,0000,0000,,And for our college Dialogue: 0,0:01:48.71,0:01:49.83,Default,,0000,0000,0000,,table, let's say that every Dialogue: 0,0:01:50.03,0:01:50.88,Default,,0000,0000,0000,,college is going to have Dialogue: 0,0:01:51.00,0:01:54.09,Default,,0000,0000,0000,,a name, a state, and an enrollment. Dialogue: 0,0:01:55.17,0:01:56.44,Default,,0000,0000,0000,,We'll just abbreviate that ENR. Dialogue: 0,0:01:57.66,0:01:58.53,Default,,0000,0000,0000,,So those are the labeled columns. Dialogue: 0,0:01:59.81,0:02:01.01,Default,,0000,0000,0000,,Now the actual data itself Dialogue: 0,0:02:01.50,0:02:02.32,Default,,0000,0000,0000,,is stored in what are Dialogue: 0,0:02:02.43,0:02:04.74,Default,,0000,0000,0000,,called the tuples (or the rows) in the tables. Dialogue: 0,0:02:05.69,0:02:06.82,Default,,0000,0000,0000,,So let's put a couple Dialogue: 0,0:02:06.99,0:02:09.18,Default,,0000,0000,0000,,of the data tables, data tuples in our tables. Dialogue: 0,0:02:09.30,0:02:11.53,Default,,0000,0000,0000,,So let's start with the Dialogue: 0,0:02:12.14,0:02:13.63,Default,,0000,0000,0000,,students and lets say that Dialogue: 0,0:02:14.12,0:02:15.43,Default,,0000,0000,0000,,our first student has ID 123. Dialogue: 0,0:02:15.60,0:02:18.05,Default,,0000,0000,0000,,Name is Amy - Dialogue: 0,0:02:18.48,0:02:21.79,Default,,0000,0000,0000,,GPA 3.9, and she's happy with that. Dialogue: 0,0:02:21.90,0:02:22.60,Default,,0000,0000,0000,,So she has a smiley photo. Dialogue: 0,0:02:23.72,0:02:25.29,Default,,0000,0000,0000,,And our second student is 234, Dialogue: 0,0:02:26.13,0:02:28.32,Default,,0000,0000,0000,,Bob - his GPA Dialogue: 0,0:02:29.68,0:02:29.88,Default,,0000,0000,0000,,is 3.4. Dialogue: 0,0:02:30.08,0:02:30.85,Default,,0000,0000,0000,,He's not quite as happy. Dialogue: 0,0:02:32.05,0:02:32.97,Default,,0000,0000,0000,,And typically of course a Dialogue: 0,0:02:33.13,0:02:35.09,Default,,0000,0000,0000,,table will have thousands, maybe Dialogue: 0,0:02:35.36,0:02:37.07,Default,,0000,0000,0000,,millions, even sometimes billions of Dialogue: 0,0:02:37.21,0:02:40.39,Default,,0000,0000,0000,,rows, each row containing a value for each attribute. Dialogue: 0,0:02:41.31,0:02:42.62,Default,,0000,0000,0000,,In our college table, let's suppose Dialogue: 0,0:02:43.11,0:02:44.03,Default,,0000,0000,0000,,we have .... well of course Dialogue: 0,0:02:44.18,0:02:46.63,Default,,0000,0000,0000,,we're going to start with Stanford in Dialogue: 0,0:02:46.77,0:02:49.72,Default,,0000,0000,0000,,the state of California and Stanford's enrollment is 15,000. Dialogue: 0,0:02:52.31,0:02:53.87,Default,,0000,0000,0000,,We'll include our cross-bay rival Berkeley Dialogue: 0,0:02:54.77,0:02:55.52,Default,,0000,0000,0000,,again, in the state of California. Dialogue: 0,0:02:56.25,0:02:58.11,Default,,0000,0000,0000,,Berkeley's enrollment is a whopping 36,000. Dialogue: 0,0:02:58.66,0:03:00.57,Default,,0000,0000,0000,,And last of all, Dialogue: 0,0:03:01.27,0:03:03.81,Default,,0000,0000,0000,,we are going to not be West Coast biased. Dialogue: 0,0:03:04.17,0:03:05.50,Default,,0000,0000,0000,,We'll include MIT in the Dialogue: 0,0:03:05.56,0:03:07.56,Default,,0000,0000,0000,,state of Massachusetts with an enrollment of 10,000. Dialogue: 0,0:03:08.33,0:03:09.53,Default,,0000,0000,0000,,Now of course there's Dialogue: 0,0:03:09.67,0:03:11.04,Default,,0000,0000,0000,,gonna be again many more Dialogue: 0,0:03:11.10,0:03:12.27,Default,,0000,0000,0000,,tuples in the college table, and Dialogue: 0,0:03:12.40,0:03:13.80,Default,,0000,0000,0000,,many more tuples in the student table. Dialogue: 0,0:03:15.05,0:03:16.64,Default,,0000,0000,0000,,Okay, next, let me Dialogue: 0,0:03:16.87,0:03:18.22,Default,,0000,0000,0000,,mention that in a relational Dialogue: 0,0:03:18.71,0:03:19.90,Default,,0000,0000,0000,,database, typically each attribute or Dialogue: 0,0:03:19.93,0:03:21.21,Default,,0000,0000,0000,,column has a type Dialogue: 0,0:03:21.91,0:03:23.04,Default,,0000,0000,0000,,sometimes referred to as a domain. Dialogue: 0,0:03:23.94,0:03:25.04,Default,,0000,0000,0000,,For example, the ID might Dialogue: 0,0:03:25.19,0:03:26.35,Default,,0000,0000,0000,,be an integer, the name Dialogue: 0,0:03:26.60,0:03:27.92,Default,,0000,0000,0000,,might be a string, GPA might Dialogue: 0,0:03:28.18,0:03:29.60,Default,,0000,0000,0000,,be a float, photo might Dialogue: 0,0:03:29.93,0:03:31.67,Default,,0000,0000,0000,,be a jpeg file. Dialogue: 0,0:03:32.93,0:03:34.16,Default,,0000,0000,0000,,We do also in most relational Dialogue: 0,0:03:34.58,0:03:36.53,Default,,0000,0000,0000,,databases have a concept of enumerated domain. Dialogue: 0,0:03:37.01,0:03:38.43,Default,,0000,0000,0000,,So for example, the state might Dialogue: 0,0:03:38.72,0:03:40.66,Default,,0000,0000,0000,,be an enumerated domain for Dialogue: 0,0:03:40.99,0:03:42.55,Default,,0000,0000,0000,,the 50 abbreviations for states. Dialogue: 0,0:03:43.51,0:03:45.02,Default,,0000,0000,0000,,Now, it's typical for relational Dialogue: 0,0:03:45.04,0:03:46.48,Default,,0000,0000,0000,,databases to have just Dialogue: 0,0:03:46.67,0:03:47.92,Default,,0000,0000,0000,,atomic types in their Dialogue: 0,0:03:48.38,0:03:50.18,Default,,0000,0000,0000,,attributes as we have Dialogue: 0,0:03:50.40,0:03:52.07,Default,,0000,0000,0000,,here, but many database Dialogue: 0,0:03:52.44,0:03:53.74,Default,,0000,0000,0000,,systems do also support structured Dialogue: 0,0:03:54.28,0:03:55.46,Default,,0000,0000,0000,,types inside attributes. Dialogue: 0,0:03:58.55,0:03:59.39,Default,,0000,0000,0000,,Okay, a little bit more terminology. Dialogue: 0,0:04:00.30,0:04:01.34,Default,,0000,0000,0000,,The schema of a Dialogue: 0,0:04:01.38,0:04:04.11,Default,,0000,0000,0000,,database is the structure of the relation. Dialogue: 0,0:04:04.59,0:04:07.01,Default,,0000,0000,0000,,So the schema includes the name Dialogue: 0,0:04:07.43,0:04:09.00,Default,,0000,0000,0000,,of the relation and the attributes Dialogue: 0,0:04:09.29,0:04:11.38,Default,,0000,0000,0000,,of the relation and the types of those attributes. Dialogue: 0,0:04:12.14,0:04:13.31,Default,,0000,0000,0000,,Where the instance is the Dialogue: 0,0:04:13.41,0:04:15.99,Default,,0000,0000,0000,,actual contents of the table at a given point in time. Dialogue: 0,0:04:16.35,0:04:17.24,Default,,0000,0000,0000,,So, typically you set up Dialogue: 0,0:04:17.36,0:04:19.02,Default,,0000,0000,0000,,a schema in advance, then the Dialogue: 0,0:04:19.49,0:04:21.81,Default,,0000,0000,0000,,instances of the data will change over time. Dialogue: 0,0:04:23.92,0:04:25.86,Default,,0000,0000,0000,,Now, I mentioned that most columns have types. Dialogue: 0,0:04:26.66,0:04:28.00,Default,,0000,0000,0000,,But, there's also a special value Dialogue: 0,0:04:28.48,0:04:29.68,Default,,0000,0000,0000,,that's in any type of Dialogue: 0,0:04:29.76,0:04:31.24,Default,,0000,0000,0000,,any column and that's a Dialogue: 0,0:04:31.35,0:04:32.59,Default,,0000,0000,0000,,special value known as null, and nulls Dialogue: 0,0:04:32.73,0:04:34.34,Default,,0000,0000,0000,,are actually quite important in relational databases. Dialogue: 0,0:04:35.39,0:04:36.76,Default,,0000,0000,0000,,Null values are used to Dialogue: 0,0:04:36.91,0:04:38.27,Default,,0000,0000,0000,,denote that a particular Dialogue: 0,0:04:38.98,0:04:41.28,Default,,0000,0000,0000,,value is maybe unknown or undefined. Dialogue: 0,0:04:42.65,0:04:44.22,Default,,0000,0000,0000,,And, so let's suppose, let's add Dialogue: 0,0:04:44.58,0:04:46.93,Default,,0000,0000,0000,,another tuple to our database. Dialogue: 0,0:04:47.63,0:04:49.68,Default,,0000,0000,0000,,Let's say 345, another student Dialogue: 0,0:04:50.12,0:04:51.67,Default,,0000,0000,0000,,named Craig, and for, Dialogue: 0,0:04:51.81,0:04:53.22,Default,,0000,0000,0000,,whatever reason Craig doesn't have a GPA. Dialogue: 0,0:04:53.53,0:04:54.63,Default,,0000,0000,0000,,Maybe Craig is home schooled, Dialogue: 0,0:04:55.12,0:04:56.81,Default,,0000,0000,0000,,maybe Craig doesn't want to reveal his GPA. Dialogue: 0,0:04:57.54,0:04:58.74,Default,,0000,0000,0000,,So then the database would contain Dialogue: 0,0:04:59.21,0:05:00.53,Default,,0000,0000,0000,,a null value for Craig Dialogue: 0,0:05:01.62,0:05:03.31,Default,,0000,0000,0000,,and we'll just put a neutral face there. Dialogue: 0,0:05:04.43,0:05:06.93,Default,,0000,0000,0000,,Or, for example, maybe Bob doesn't Dialogue: 0,0:05:07.22,0:05:08.25,Default,,0000,0000,0000,,want to have his photo in Dialogue: 0,0:05:08.34,0:05:09.73,Default,,0000,0000,0000,,the database, so then Bob Dialogue: 0,0:05:10.56,0:05:12.10,Default,,0000,0000,0000,,would have a null value Dialogue: 0,0:05:12.81,0:05:14.89,Default,,0000,0000,0000,,for his photo, again nulls can go anywhere. Dialogue: 0,0:05:15.69,0:05:16.75,Default,,0000,0000,0000,,Now null values are useful Dialogue: 0,0:05:17.16,0:05:17.85,Default,,0000,0000,0000,,but one has to be very Dialogue: 0,0:05:18.29,0:05:19.57,Default,,0000,0000,0000,,careful in a database system Dialogue: 0,0:05:19.92,0:05:21.02,Default,,0000,0000,0000,,when you run queries Dialogue: 0,0:05:21.66,0:05:23.20,Default,,0000,0000,0000,,over relations that have null values. Dialogue: 0,0:05:23.65,0:05:24.71,Default,,0000,0000,0000,,In a later video we'll go Dialogue: 0,0:05:24.82,0:05:25.91,Default,,0000,0000,0000,,into this in more detail, but I Dialogue: 0,0:05:25.99,0:05:26.69,Default,,0000,0000,0000,,just wanted to give a just Dialogue: 0,0:05:26.94,0:05:28.26,Default,,0000,0000,0000,,sort of example of what can happen. Dialogue: 0,0:05:29.13,0:05:30.29,Default,,0000,0000,0000,,So, let's suppose we're Dialogue: 0,0:05:30.36,0:05:31.61,Default,,0000,0000,0000,,asking a query over our Dialogue: 0,0:05:31.80,0:05:32.90,Default,,0000,0000,0000,,student table of all students Dialogue: 0,0:05:33.41,0:05:35.06,Default,,0000,0000,0000,,whose GPA is greater than 3.5. Dialogue: 0,0:05:36.04,0:05:37.33,Default,,0000,0000,0000,,So when we run Dialogue: 0,0:05:37.46,0:05:38.38,Default,,0000,0000,0000,,that query on our database Dialogue: 0,0:05:38.93,0:05:40.02,Default,,0000,0000,0000,,obviously we'll get Amy out, Dialogue: 0,0:05:40.72,0:05:43.07,Default,,0000,0000,0000,,obviously we won't get Bob out, but should we get Craig? Dialogue: 0,0:05:43.49,0:05:44.50,Default,,0000,0000,0000,,The answer is No. Dialogue: 0,0:05:44.94,0:05:45.84,Default,,0000,0000,0000,,We don't know for a fact Dialogue: 0,0:05:46.07,0:05:47.14,Default,,0000,0000,0000,,that Craig's GPA is greater Dialogue: 0,0:05:47.40,0:05:48.84,Default,,0000,0000,0000,,than 3.5, so we'll only get Dialogue: 0,0:05:48.98,0:05:50.58,Default,,0000,0000,0000,,one student out from that query. Dialogue: 0,0:05:50.95,0:05:52.64,Default,,0000,0000,0000,,Now let's suppose we Dialogue: 0,0:05:52.74,0:05:53.75,Default,,0000,0000,0000,,had another query, where we Dialogue: 0,0:05:53.83,0:05:54.90,Default,,0000,0000,0000,,were gonna ask for the GPA Dialogue: 0,0:05:55.76,0:05:56.94,Default,,0000,0000,0000,,less than or equal to 3.5. Dialogue: 0,0:05:57.59,0:05:59.36,Default,,0000,0000,0000,,So, similarly where we Dialogue: 0,0:05:59.66,0:06:00.64,Default,,0000,0000,0000,,would not have Amy in result Dialogue: 0,0:06:01.09,0:06:02.21,Default,,0000,0000,0000,,and we would certainly have Bob in Dialogue: 0,0:06:02.33,0:06:04.08,Default,,0000,0000,0000,,the result and similarly would Dialogue: 0,0:06:04.23,0:06:05.23,Default,,0000,0000,0000,,not have Craig in the Dialogue: 0,0:06:05.40,0:06:06.38,Default,,0000,0000,0000,,result because we don't know that Dialogue: 0,0:06:06.49,0:06:08.16,Default,,0000,0000,0000,,his GPA is less than or equal to 3.5. Dialogue: 0,0:06:08.72,0:06:10.07,Default,,0000,0000,0000,,So far so good, but Dialogue: 0,0:06:10.40,0:06:11.63,Default,,0000,0000,0000,,it gets a little weird is Dialogue: 0,0:06:11.76,0:06:12.83,Default,,0000,0000,0000,,when we add an or here Dialogue: 0,0:06:13.05,0:06:14.24,Default,,0000,0000,0000,,in our query, we say I Dialogue: 0,0:06:14.64,0:06:15.70,Default,,0000,0000,0000,,want everyone who's GPA is greater Dialogue: 0,0:06:16.00,0:06:18.70,Default,,0000,0000,0000,,than 3.5 or who's GPA is less than or equal to 3.5. Dialogue: 0,0:06:18.97,0:06:20.66,Default,,0000,0000,0000,,And even though it Dialogue: 0,0:06:20.75,0:06:22.12,Default,,0000,0000,0000,,looks like every tuple should Dialogue: 0,0:06:22.50,0:06:23.79,Default,,0000,0000,0000,,satisfy this condition, that it's Dialogue: 0,0:06:23.92,0:06:26.32,Default,,0000,0000,0000,,always true, that's not the case when we have null values. Dialogue: 0,0:06:27.07,0:06:28.03,Default,,0000,0000,0000,,So, that's why one has to Dialogue: 0,0:06:28.13,0:06:29.16,Default,,0000,0000,0000,,be careful when one uses Dialogue: 0,0:06:29.46,0:06:31.11,Default,,0000,0000,0000,,null values in relational databases. Dialogue: 0,0:06:32.36,0:06:33.83,Default,,0000,0000,0000,,Let me erase this now and Dialogue: 0,0:06:33.97,0:06:35.11,Default,,0000,0000,0000,,let's move on to our next concept Dialogue: 0,0:06:35.74,0:06:37.06,Default,,0000,0000,0000,,which is the concept of Key. Dialogue: 0,0:06:38.21,0:06:41.16,Default,,0000,0000,0000,,Key is again another important concept in relational databases. Dialogue: 0,0:06:42.48,0:06:43.59,Default,,0000,0000,0000,,And, a key is an Dialogue: 0,0:06:43.99,0:06:45.07,Default,,0000,0000,0000,,attribute in of a relation Dialogue: 0,0:06:45.41,0:06:48.60,Default,,0000,0000,0000,,where every value for that attribute is unique. Dialogue: 0,0:06:49.54,0:06:50.33,Default,,0000,0000,0000,,So if we look at the Dialogue: 0,0:06:50.41,0:06:51.96,Default,,0000,0000,0000,,student relation, we can feel Dialogue: 0,0:06:52.15,0:06:54.56,Default,,0000,0000,0000,,pretty confident that the ID is going to be a key. Dialogue: 0,0:06:54.96,0:06:56.12,Default,,0000,0000,0000,,In other words, every tuple is Dialogue: 0,0:06:56.25,0:06:58.13,Default,,0000,0000,0000,,going to have a unique for ID. Dialogue: 0,0:06:59.64,0:07:02.22,Default,,0000,0000,0000,,Thinking about the college relation, it's a little less clear. Dialogue: 0,0:07:02.61,0:07:03.64,Default,,0000,0000,0000,,We might be tempted to say Dialogue: 0,0:07:03.73,0:07:04.83,Default,,0000,0000,0000,,that the name of the college is Dialogue: 0,0:07:04.96,0:07:06.33,Default,,0000,0000,0000,,an ID, that actually college Dialogue: 0,0:07:06.72,0:07:09.41,Default,,0000,0000,0000,,names probably are not unique across the country. Dialogue: 0,0:07:10.00,0:07:10.78,Default,,0000,0000,0000,,There's probably a lot of or Dialogue: 0,0:07:10.88,0:07:13.13,Default,,0000,0000,0000,,several colleges named Washington college for example. Dialogue: 0,0:07:14.09,0:07:15.06,Default,,0000,0000,0000,,You know what, we're allowed to Dialogue: 0,0:07:15.27,0:07:16.72,Default,,0000,0000,0000,,have sets of attributes that Dialogue: 0,0:07:16.92,0:07:18.83,Default,,0000,0000,0000,,are unique and that makes sense in the college relation. Dialogue: 0,0:07:19.78,0:07:21.60,Default,,0000,0000,0000,,Most likely the combination of Dialogue: 0,0:07:21.67,0:07:22.85,Default,,0000,0000,0000,,the name and state of Dialogue: 0,0:07:22.93,0:07:24.20,Default,,0000,0000,0000,,a college is unique, and that's Dialogue: 0,0:07:24.49,0:07:26.67,Default,,0000,0000,0000,,what we would identify as the key for the college relation. Dialogue: 0,0:07:27.72,0:07:28.82,Default,,0000,0000,0000,,Now, you might wonder why it's Dialogue: 0,0:07:28.98,0:07:32.17,Default,,0000,0000,0000,,even important to have attributes that are identified as keys. Dialogue: 0,0:07:32.57,0:07:34.04,Default,,0000,0000,0000,,There's actually several uses for them. Dialogue: 0,0:07:34.70,0:07:37.11,Default,,0000,0000,0000,,One of them is just to identify specific tuples. Dialogue: 0,0:07:37.55,0:07:38.53,Default,,0000,0000,0000,,So if you want to run Dialogue: 0,0:07:38.97,0:07:39.75,Default,,0000,0000,0000,,a query to get a specific Dialogue: 0,0:07:40.36,0:07:41.90,Default,,0000,0000,0000,,tuple out of the database you Dialogue: 0,0:07:42.05,0:07:44.65,Default,,0000,0000,0000,,would do that by asking for that tuple by its key. Dialogue: 0,0:07:45.05,0:07:46.64,Default,,0000,0000,0000,,And related to that Dialogue: 0,0:07:46.87,0:07:48.01,Default,,0000,0000,0000,,database systems for efficiency Dialogue: 0,0:07:48.77,0:07:50.09,Default,,0000,0000,0000,,tend to build special index Dialogue: 0,0:07:50.56,0:07:52.81,Default,,0000,0000,0000,,structures or store the database in a particular way. Dialogue: 0,0:07:53.08,0:07:55.85,Default,,0000,0000,0000,,So it's very fast to find a tuple based on its key. Dialogue: 0,0:07:56.81,0:07:58.25,Default,,0000,0000,0000,,And lastly, if one relation Dialogue: 0,0:07:58.90,0:08:00.20,Default,,0000,0000,0000,,in a relational database wants Dialogue: 0,0:08:00.46,0:08:01.47,Default,,0000,0000,0000,,to refer to tuples of another, Dialogue: 0,0:08:02.11,0:08:04.36,Default,,0000,0000,0000,,there 's no concept of pointer in relational databases. Dialogue: 0,0:08:05.40,0:08:06.80,Default,,0000,0000,0000,,Therefore, the first relation Dialogue: 0,0:08:07.26,0:08:08.47,Default,,0000,0000,0000,,will typically refer to a Dialogue: 0,0:08:08.53,0:08:10.69,Default,,0000,0000,0000,,tuple in the second relation by its unique key. Dialogue: 0,0:08:11.09,0:08:13.46,Default,,0000,0000,0000,,As our videos develop we'll see the importance of keys. Dialogue: 0,0:08:15.10,0:08:16.31,Default,,0000,0000,0000,,Okay, just to wrap up, Dialogue: 0,0:08:16.96,0:08:18.52,Default,,0000,0000,0000,,I'll mention how one creates relations Dialogue: 0,0:08:19.10,0:08:20.99,Default,,0000,0000,0000,,or tables in the SQL language. Dialogue: 0,0:08:21.44,0:08:22.58,Default,,0000,0000,0000,,It's very simple, you just Dialogue: 0,0:08:22.89,0:08:24.42,Default,,0000,0000,0000,,say "create table," give the Dialogue: 0,0:08:24.50,0:08:26.20,Default,,0000,0000,0000,,name of the relation and a list of the attributes. Dialogue: 0,0:08:27.47,0:08:28.91,Default,,0000,0000,0000,,And if you want to give types for the attributes. Dialogue: 0,0:08:29.76,0:08:30.92,Default,,0000,0000,0000,,It's similar except you follow Dialogue: 0,0:08:31.19,0:08:32.91,Default,,0000,0000,0000,,each attribute name with its type. Dialogue: 0,0:08:33.97,0:08:35.10,Default,,0000,0000,0000,,So to wrap up, the relational Dialogue: 0,0:08:35.63,0:08:37.08,Default,,0000,0000,0000,,model has been around a long time. Dialogue: 0,0:08:37.44,0:08:39.09,Default,,0000,0000,0000,,Has started a huge industry. Dialogue: 0,0:08:39.35,0:08:40.56,Default,,0000,0000,0000,,It's used by all database systems. Dialogue: 0,0:08:41.49,0:08:42.33,Default,,0000,0000,0000,,As you've seen it's a very Dialogue: 0,0:08:42.49,0:08:43.52,Default,,0000,0000,0000,,simple model and will shortly Dialogue: 0,0:08:43.95,0:08:46.01,Default,,0000,0000,0000,,see that it can be queried with very nice languages. Dialogue: 0,0:08:46.65,0:08:48.45,Default,,0000,0000,0000,,And, finally, it's been implemented very efficiently.